Compare commits

..
Author SHA1 Message Date
Fuchimoto1234 aeb56b9ef5 memo 2023-12-18 14:14:48 +09:00
186 changed files with 1149 additions and 3668 deletions

No files matched your search

@@ -1,10 +0,0 @@
---
name: 新機能用テンプレート
about: 新規開発Issue用テンプレート
title: ''
labels: ''
assignees: ''
---
WIP
-8
View File
@@ -4,14 +4,6 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2023-12-18T03:36:14.973846Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=ZY22H7V3G7" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState>
</selectionStates>
</component>
+1 -7
View File
@@ -4,6 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="jbr-17" />
<option name="modules">
@@ -22,13 +23,6 @@
<option value="$PROJECT_DIR$/feature/library" />
<option value="$PROJECT_DIR$/feature/scan" />
<option value="$PROJECT_DIR$/feature/search" />
<option value="$PROJECT_DIR$/model" />
<option value="$PROJECT_DIR$/processor" />
<option value="$PROJECT_DIR$/shared" />
<option value="$PROJECT_DIR$/shared/icon" />
<option value="$PROJECT_DIR$/shared/ui" />
<option value="$PROJECT_DIR$/source" />
<option value="$PROJECT_DIR$/utils" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
+1 -1
View File
@@ -1,6 +1,6 @@
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
+1 -5
View File
@@ -1,11 +1,7 @@
# Lacerta
WIP
## モジュール設計
![Untitled Diagram(2)](https://github.com/lacerta-doc/Lacerta/assets/66072112/9daabaca-5cdc-49f8-ac66-196c588a47c9)
## メモ
- アイコン: Google Material Icons https://fonts.google.com/icons (Weight:300, Grade:0, Optical size: 24px)
![Untitled Diagram drawio(2)](https://github.com/lacerta-doc/Lacerta/assets/66072112/47006ffd-0fd3-4eec-8a28-fb9629b990bf)
## コーディング規則/推奨(WIP)
### 規則
-20
View File
@@ -18,21 +18,6 @@ android {
}
buildTypes {
debug { // 開発メンバー用
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
applicationIdSuffix ".debug"
matchingFallbacks = ['release']
}
beta_release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
applicationIdSuffix ".beta"
matchingFallbacks = ['release']
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
@@ -73,11 +58,6 @@ dependencies {
// implementation project(':data:source:preference')
//
implementation project(':data')
implementation project(':shared:ui')
implementation project(':shared:icon')
// Hilt (DI)
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
@@ -11,8 +11,6 @@ public class LacertaApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// DynamicColorを有効化
DynamicColors.applyToActivitiesIfAvailable(this);
}
}
+1 -2
View File
@@ -4,7 +4,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".MainActivity">
<androidx.fragment.app.FragmentContainerView
@@ -18,7 +17,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/main_nav"
tools:layout="@layout/fragment_debug_menu_container" />
tools:layout="@layout/fragment_debug_menu" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
+1 -12
View File
@@ -1,20 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@id/feature_home_navigation"
android:icon="@drawable/home_24px"
android:title="Home"/>
<item
android:id="@id/feature_library_navigation"
android:icon="@drawable/folder_24px"
android:title="Library"/>
<item
android:id="@id/feature_debug_navigation"
android:icon="@drawable/developer_mode_24px"
android:title="Debug menu"/>
android:title="DebugMenu"/>
</menu>
-4
View File
@@ -6,9 +6,5 @@
<include app:graph="@navigation/feature_debug_navigation" />
<include app:graph="@navigation/feature_library_navigation" />
<include app:graph="@navigation/feature_home_navigation" />
</navigation>
+7
View File
@@ -0,0 +1,7 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your dark theme here. -->
<!-- <item name="colorPrimary">@color/my_dark_primary</item> -->
</style>
</resources>
+61
View File
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- UI -->
<color name="ui_bg">@android:color/system_neutral1_50</color>
<color name="ui_fg">@android:color/system_neutral1_900</color>
<color name="ui_fg_disabled">@android:color/system_neutral1_400</color>
<color name="ui_fg_secondary">@android:color/system_neutral2_600</color> <!-- A12 B2: 700 -->
<color name="ui_accent">@color/accent_dark</color>
<color name="ui_accent_inverse">@color/accent_light</color>
<color name="ui_accent_variant">@color/accent_variant_dark</color>
<color name="ui_surface">@android:color/system_accent1_50</color>
<color name="ui_primary_surface">@android:color/system_accent1_100</color>
<color name="changelog_bg">@android:color/system_neutral2_50</color>
<color name="changelog_border">@android:color/system_neutral1_400</color>
<color name="error">#DA000E</color>
<color name="success">#008753</color>
<!-- Launcher icon -->
<color name="launcher_fg">@android:color/system_neutral2_700</color>
<color name="launcher_bg">@android:color/background_light</color>
<color name="accent_light">@android:color/system_accent1_300</color>
<color name="accent_dark">@android:color/system_accent1_600</color>
<color name="accent_variant_light">@android:color/system_accent3_100</color>
<color name="accent_variant_dark">@android:color/system_accent3_600</color>
<!-- Material3 colors -->
<color name="colorPrimaryLight">@color/material_dynamic_primary40</color>
<color name="colorPrimaryDark">@color/material_dynamic_primary80</color>
<color name="colorPrimaryContainerLight">@color/material_dynamic_primary90</color>
<color name="colorPrimaryContainerDark">@color/material_dynamic_primary30</color>
<color name="colorOnPrimaryContainerLight">@color/material_dynamic_primary10</color>
<color name="colorOnPrimaryContainerDark">@color/material_dynamic_primary90</color>
<color name="colorSecondaryContainerLight">@color/material_dynamic_secondary90</color>
<color name="colorSecondaryContainerDark">@color/material_dynamic_secondary90</color>
<color name="colorOnSecondaryContainerLight">@color/material_dynamic_secondary10</color>
<color name="colorOnSecondaryContainerDark">@color/material_dynamic_secondary10</color>
<color name="colorTertiaryLight">@color/material_dynamic_tertiary40</color>
<color name="colorTertiaryDark">@color/material_dynamic_tertiary80</color>
<color name="colorOnTertiaryLight">@color/material_dynamic_primary100</color>
<color name="colorOnTertiaryDark">@color/material_dynamic_tertiary20</color>
<color name="colorTertiaryContainerLight">@color/material_dynamic_tertiary90</color>
<color name="colorTertiaryContainerDark">@color/material_dynamic_tertiary30</color>
<color name="colorOnTertiaryContainerLight">@color/material_dynamic_tertiary10</color>
<color name="colorOnTertiaryContainerDark">@color/material_dynamic_tertiary90</color>
<color name="colorSurfaceLight">@color/material_dynamic_neutral99</color>
<color name="colorSurfaceDark">@color/material_dynamic_neutral10</color>
<color name="colorOnSurfaceLight">@color/material_dynamic_neutral10</color>
<color name="colorOnSurfaceDark">@color/material_dynamic_neutral90</color>
<color name="colorSurfaceVariantLight">@color/material_dynamic_neutral_variant90</color>
<color name="colorSurfaceVariantDark">@color/material_dynamic_neutral_variant30</color>
<color name="colorOnSurfaceVariantLight">@color/material_dynamic_neutral_variant30</color>
<color name="colorOnSurfaceVariantDark">@color/material_dynamic_neutral_variant80</color>
<color name="colorOutlineLight">@color/material_dynamic_neutral_variant50</color>
<color name="colorOutlineDark">@color/material_dynamic_neutral_variant60</color>
<color name="colorErrorContainerLight">#FFF9DEDC</color>
<color name="colorErrorContainerDark">#FF8C1D18</color>
<color name="colorOnErrorContainerLight">#FF410E0B</color>
<color name="colorOnErrorContainerDark">#FFF9DEDC</color>
</resources>
+9
View File
@@ -0,0 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.Lacerta" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
<style name="Theme.Lacerta" parent="Base.Theme.Lacerta" />
</resources>
+3 -16
View File
@@ -8,7 +8,7 @@ android {
compileSdk 34
defaultConfig {
minSdk 26
minSdk 24
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
@@ -38,19 +38,6 @@ dependencies {
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
// JGit
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r'
// Room
implementation libs.androidx.room.runtime
annotationProcessor libs.androidx.room.compiler
// Utilsモジュール
implementation project(':utils')
// 型モジュール
implementation project(':model')
// データソースモジュール
implementation project(':source')
// libsディレクトリにあるライブラリを追加
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
Binary file not shown.
@@ -1,46 +0,0 @@
package one.nem.lacerta.data;
import java.lang.reflect.Array;
import java.util.ArrayList;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
/**
* ドキュメントのデータを取得する
*/
public interface Document {
ArrayList<DocumentMeta> getAllDocumentMetas(int limit);
ArrayList<DocumentMeta> getAllDocumentMetas(int limit, int offset);
/**
* 更新の新しいドキュメントから順に並べてlimit件取得する
* @param limit 取得する上限数
*/
ArrayList<DocumentMeta> getRecentDocumentMetas(int limit);
/**
* 更新の新しいドキュメントから順に並べてoffset位置からlimit件取得する
* @param limit 取得する上限数
* @param offset 取得するオフセット
*/
ArrayList<DocumentMeta> getRecentDocumentMetas(int limit, int offset);
/**
* ドキュメントIDからDocumentDetailを取得する
* @param id ドキュメントID
*/
DocumentDetail getDocumentDetail(String id);
/**
* DocumentMetaからDocumentDetailを取得する
* @param meta DocumentMeta
*/
DocumentDetail getDocumentDetailByMeta(DocumentMeta meta); // 簡単に使えるように
DocumentDetail createDocumentByMeta(DocumentMeta meta);
}
@@ -1,12 +0,0 @@
package one.nem.lacerta.data;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
public interface DocumentDebug {
void insertDocument(DocumentMeta meta, DocumentDetail detail);
}
@@ -0,0 +1,26 @@
package one.nem.lacerta.data.impl;
import android.os.Build;
import one.nem.lacerta.data.repository.DeviceMeta;
import one.nem.lacerta.data.model.DeviceMetaModel;
import javax.inject.Inject;
public class DeviceMetaImpl implements DeviceMeta{
@Inject
public DeviceMetaImpl() {
}
public DeviceMetaModel getDeviceMeta() {
DeviceMetaModel deviceMetaModel = new DeviceMetaModel(
Build.MANUFACTURER,
Build.MODEL,
Build.VERSION.RELEASE,
Build.VERSION.SDK_INT
);
return deviceMetaModel;
}
}
@@ -1,47 +0,0 @@
package one.nem.lacerta.data.impl;
import java.util.List;
import javax.inject.Inject;
import one.nem.lacerta.data.DocumentDebug;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity;
import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.database.LacertaDatabase;
public class DocumentDebugImpl implements DocumentDebug{
@Inject
LacertaDatabase database;
@Inject
public DocumentDebugImpl() {
}
public void insertDocument(DocumentMeta meta, DocumentDetail detail) {
DocumentEntity documentEntity = new DocumentEntity();
LibraryEntity libraryEntity = new LibraryEntity();
documentEntity.id = meta.getId();
documentEntity.title = meta.getTitle();
documentEntity.createdAt = meta.getCreatedAt();
documentEntity.updatedAt = meta.getUpdatedAt();
documentEntity.author = detail.getAuthor();
documentEntity.defaultBranch = detail.getDefaultBranch();
// ArrayListからListに変換
documentEntity.tagIds = meta.getTagIds();
libraryEntity.id = meta.getId();
libraryEntity.path = "Placeholder";
libraryEntity.rootPath = "Placeholder";
database.documentDao().insert(documentEntity);
database.libraryDao().insert(libraryEntity);
}
}
@@ -1,141 +0,0 @@
package one.nem.lacerta.data.impl;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
import one.nem.lacerta.source.database.LacertaDatabase;
import one.nem.lacerta.source.database.entity.DocumentEntity;
import one.nem.lacerta.source.database.entity.LibraryEntity;
import one.nem.lacerta.source.database.entity.TagEntity;
import one.nem.lacerta.source.jgit.JGitRepository;
import one.nem.lacerta.utils.repository.DeviceInfoUtils;
public class DocumentImpl implements Document{
private LacertaDatabase database;
@Inject
public DocumentImpl(LacertaDatabase database) {
this.database = database;
}
@Inject
JGitRepository jGitRepository;
@Inject
DeviceInfoUtils deviceInfoUtils;
@Override
public ArrayList<DocumentMeta> getAllDocumentMetas(int limit) {
ArrayList<DocumentMeta> documentMetas = new ArrayList<>();
List<DocumentEntity> documentEntities = database.documentDao().getAllWithLimit(limit);
for (DocumentEntity documentEntity : documentEntities) {
// タグ取得
// TODO-rca: 切り出すべきかも?
List<TagEntity> tagEntities = database.tagDao().findByIds(documentEntity.tagIds);
ArrayList<DocumentTag> documentTags = new ArrayList<>();
for (TagEntity tagEntity : tagEntities) {
documentTags.add(new DocumentTag(tagEntity.id, tagEntity.tagName, tagEntity.color));
}
// 組み立て処理
// 可読性が終わるのでコンストラクタはつかわないほうがいいかも?
DocumentMeta documentMeta = new DocumentMeta();
documentMeta.setId(documentEntity.id);
documentMeta.setTitle(documentEntity.title);
documentMeta.setCreatedAt(documentEntity.createdAt);
documentMeta.setUpdatedAt(documentEntity.updatedAt);
documentMeta.setTags(documentTags);
documentMetas.add(documentMeta);
}
return documentMetas;
}
@Override
public ArrayList<DocumentMeta> getAllDocumentMetas(int limit, int offset) {
return null; // TODO-rca: 実装する
}
@Override
public ArrayList<DocumentMeta> getRecentDocumentMetas(int limit) {
// ArrayList<DocumentMeta> documentMetas = new ArrayList<>();
// database.documentDao().
// TODO-rca: 履歴取得するDao実装する
return null;
}
@Override
public ArrayList<DocumentMeta> getRecentDocumentMetas(int limit, int offset) {
return null;
}
@Override
public DocumentDetail getDocumentDetail(String id) {
DocumentDetail documentDetail = new DocumentDetail();
DocumentEntity documentEntity = database.documentDao().findById(id);
// タグ取得
// TODO-rca: 切り出すべきかも?
List<TagEntity> tagEntities = database.tagDao().findByIds(documentEntity.tagIds);
ArrayList<DocumentTag> documentTags = new ArrayList<>();
for (TagEntity tagEntity : tagEntities) {
documentTags.add(new DocumentTag(tagEntity.id, tagEntity.tagName, tagEntity.color));
}
// パス取得
// TODO-rca: 切り出すべきかも?
LibraryEntity libraryEntity = database.libraryDao().findById(id);
DocumentPath documentPath = new DocumentPath(libraryEntity.rootPath, libraryEntity.path);
// リポジトリ取得
documentDetail.setRepository(jGitRepository.getRepository(id)); // TODO-rca: エラーハンドリング
// 組み立て処理
// 可読性が終わるのでコンストラクタはつかわないほうがいいかも?
DocumentMeta documentMeta = new DocumentMeta();
documentMeta.setId(documentEntity.id);
documentMeta.setTitle(documentEntity.title);
documentMeta.setCreatedAt(documentEntity.createdAt);
documentMeta.setUpdatedAt(documentEntity.updatedAt);
documentMeta.setTags(documentTags);
documentDetail.setMeta(documentMeta);
documentDetail.setAuthor(documentEntity.author);
documentDetail.setPath(documentPath);
documentDetail.setDefaultBranch(documentEntity.defaultBranch);
return documentDetail;
}
@Override
public DocumentDetail getDocumentDetailByMeta(DocumentMeta meta) {
return getDocumentDetail(meta.getId()); // TODO-rca: 効率悪いのでMetaはもらった物を使うようにする(処理を切り分ける?)
}
@Override
public DocumentDetail createDocumentByMeta(DocumentMeta meta) {
DocumentDetail documentDetail = new DocumentDetail();
documentDetail.setMeta(meta);
documentDetail.setAuthor("author"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする or Gitの設定を参照するようにする
documentDetail.setPath(new DocumentPath(deviceInfoUtils.getExternalStorageDirectoryString(), meta.getId()));
documentDetail.setDefaultBranch("master"); // TODO-rca: SharedPrefを扱う機能を作ってそこから取得するようにする?
return documentDetail;
}
}
@@ -0,0 +1,24 @@
package one.nem.lacerta.data.impl;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import one.nem.lacerta.data.model.documents.DocumentMeta;
import one.nem.lacerta.data.repository.Documents;
public class DocumentsImpl implements Documents {
@Inject
public DocumentsImpl() {
}
public ArrayList<DocumentMeta> getRecentDocuments(int limit) {
return null; // TODO-rca:
}
public ArrayList<DocumentMeta> getStarredDocuments(int limit) {
return null; // TODO-rca:
}
}
@@ -0,0 +1,26 @@
package one.nem.lacerta.data.impl;
import android.content.Context;
import android.content.SharedPreferences;
import javax.inject.Inject;
import dagger.hilt.android.qualifiers.ApplicationContext;
import one.nem.lacerta.data.repository.SharedPref;
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
public class SharedPrefImpl implements SharedPref{
private final Context applicationContext;
@Inject
public SharedPrefImpl(@ApplicationContext Context applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public SharedPreferences getSharedPreferencesByTag(SharedPrefType sharedPrefType) {
return applicationContext.getSharedPreferences(sharedPrefType.getTag(), Context.MODE_PRIVATE);
}
}
@@ -0,0 +1,56 @@
package one.nem.lacerta.data.impl.stub;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import java.util.Date;
import javax.inject.Inject;
import one.nem.lacerta.data.model.documents.DocumentMeta;
import one.nem.lacerta.data.model.documents.enums.DocumentType;
import one.nem.lacerta.data.repository.Documents;
public class DocumentsImpl implements Documents {
@Inject
public DocumentsImpl() {
}
public ArrayList<DocumentMeta> getRecentDocuments(int limit) { // Generate dummy data
ArrayList<DocumentMeta> documentMetaList = new ArrayList<>();
for (int i = 0; i < limit; i++) {
DocumentMeta documentMeta = new DocumentMeta();
documentMeta.id = UUID.randomUUID().toString();
documentMeta.name = "Document " + i;
documentMeta.created = new Date();
documentMeta.type = new Random(i).nextInt()/2 == 0 ? DocumentType.OTHER : DocumentType.NOTEBOOK;
documentMeta.tags = new String[] {"tag1", "tag2", "tag3"};
documentMeta.categories = new String[] {"category1", "category2", "category3"};
documentMetaList.add(documentMeta);
}
return documentMetaList;
}
public ArrayList<DocumentMeta> getStarredDocuments(int limit) { // Generate dummy data
ArrayList<DocumentMeta> documentMetaList = new ArrayList<>();
for (int i = 0; i < limit; i++) {
DocumentMeta documentMeta = new DocumentMeta();
documentMeta.id = UUID.randomUUID().toString();
documentMeta.name = "Document " + i;
documentMeta.created = new Date();
documentMeta.type = new Random(i).nextInt()/2 == 0 ? DocumentType.OTHER : DocumentType.NOTEBOOK;
documentMeta.tags = new String[] {"tag1", "tag2", "tag3"};
documentMeta.categories = new String[] {"category1", "category2", "category3"};
documentMetaList.add(documentMeta);
}
return documentMetaList;
}
}
@@ -0,0 +1,34 @@
package one.nem.lacerta.data.model;
public class DeviceMetaModel {
private String DeviceManufacturer;
private String DeviceModel;
private String AndroidVersion;
private int AndroidApiLevel;
public DeviceMetaModel(String DeviceManufacturer, String DeviceModel, String AndroidVersion, int AndroidApiLevel) {
this.DeviceManufacturer = DeviceManufacturer;
this.DeviceModel = DeviceModel;
this.AndroidVersion = AndroidVersion;
this.AndroidApiLevel = AndroidApiLevel;
}
// Getters
// TODO-rca: ボイラープレートコードなので削減する
public String getDeviceManufacturer() {
return DeviceManufacturer;
}
public String getDeviceModel() {
return DeviceModel;
}
public String getAndroidVersion() {
return AndroidVersion;
}
public int getAndroidApiLevel() {
return AndroidApiLevel;
}
}
@@ -0,0 +1,8 @@
package one.nem.lacerta.data.model.documents;
public class DocumentDetail {
// ドキュメントの詳細情報
private DocumentMeta documentMeta;
// TODO-rca: ドキュメントの詳細情報を格納するフィールドを追加する
}
@@ -0,0 +1,107 @@
package one.nem.lacerta.data.model.documents;
import java.util.Date;
import one.nem.lacerta.data.model.documents.enums.DocumentType;
// TODO-rca: Dateをデバイスのロケールに合わせてStringに変換するメソッドを実装する?
public class DocumentMeta {
// ドキュメントのメタ情報
public String id; // ドキュメントの内部ID(UUIDv4?)
public String name; // ドキュメントの名前
public DocumentType type; // ドキュメントの種類
public Date created; // ドキュメントの作成日時
public String[] tags; // ドキュメントのタグ
public String[] categories; // ドキュメントのカテゴリ
public DocumentMeta(String id, String name, Date created, DocumentType type, String[] tags, String[] categories) {
this.id = id;
this.name = name;
this.created = created;
this.type = type;
this.tags = tags;
this.categories = categories;
}
public DocumentMeta() {
this.id = "";
this.name = "";
this.created = new Date();
this.type = DocumentType.OTHER;
this.tags = new String[0];
this.categories = new String[0];
}
// TODO-rca: ボイラープレートコードなので削減する
// Getter
public String getId() {
return id;
}
public String getName() {
return name;
}
public Date getCreated() {
return created;
}
public DocumentType getType() {
return type;
}
public String[] getTags() {
return tags;
}
public String[] getCategories() {
return categories;
}
// Setter
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
if (name == null) {
this.name = "";
} else {
this.name = name;
}
}
public void setCreated(Date created) {
if (created == null) {
this.created = new Date();
} else {
this.created = created;
}
}
public void setType(DocumentType type) {
if (type == null) {
this.type = DocumentType.OTHER;
} else {
this.type = type;
}
}
public void setTags(String[] tags) {
if (tags == null) {
this.tags = new String[0];
} else {
this.tags = tags;
}
}
public void setCategories(String[] categories) {
if (categories == null) {
this.categories = new String[0];
} else {
this.categories = categories;
}
}
}
@@ -0,0 +1,21 @@
package one.nem.lacerta.data.model.documents.enums;
public enum DocumentType {
// ドキュメントの種類
// TODO: ユーザーがドキュメントの種類を追加できるようにする
// テキスト
TEXTBOOK,
// ノート
NOTEBOOK,
// ワークブック
WORKBOOK,
// レシート
RECEIPT,
// チケット
TICKET,
// メモ
MEMO,
// その他
OTHER
}
@@ -0,0 +1,17 @@
package one.nem.lacerta.data.model.shared_pref.enums;
public enum SharedPrefType {
COMMON("common"),
USERDATA("userdata");
private String tag;
SharedPrefType(String tag) {
this.tag = tag;
}
public String getTag() {
return tag;
}
}
@@ -0,0 +1,19 @@
package one.nem.lacerta.data.module;
import one.nem.lacerta.data.impl.DeviceMetaImpl;
import one.nem.lacerta.data.repository.DeviceMeta;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
// Singleton
import dagger.hilt.components.SingletonComponent;
@Module
@InstallIn(SingletonComponent.class)
abstract class DeviceMetaModule {
@Binds
public abstract DeviceMeta bindDeviceMeta(DeviceMetaImpl deviceMetaImpl);
}
@@ -1,16 +0,0 @@
package one.nem.lacerta.data.module;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.data.DocumentDebug;
import one.nem.lacerta.data.impl.DocumentDebugImpl;
@Module
@InstallIn(SingletonComponent.class) // TODO-rca: Singletonでいいのか検討する
abstract public class DocumentDebugModule {
@Binds
public abstract DocumentDebug bindDocumentDebug(DocumentDebugImpl documentDebugImpl);
}
@@ -1,20 +0,0 @@
package one.nem.lacerta.data.module;
import android.content.Context;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.data.impl.DocumentImpl;
@Module
@InstallIn(SingletonComponent.class) // TODO-rca: Singletonであるべきか考える
abstract public class DocumentModule {
@Binds
public abstract Document bindDocument(DocumentImpl documentImpl);
}
@@ -0,0 +1,18 @@
package one.nem.lacerta.data.module;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.data.repository.Documents;
import one.nem.lacerta.data.impl.DocumentsImpl;
@Module
@InstallIn(SingletonComponent.class)
abstract public class DocumentsModule {
@Binds
public abstract Documents bindDocuments(DocumentsImpl documentsImpl);
}
@@ -0,0 +1,19 @@
package one.nem.lacerta.data.module;
import android.content.Context;
import android.content.SharedPreferences;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.data.impl.SharedPrefImpl;
import one.nem.lacerta.data.repository.SharedPref;
@Module
@InstallIn(SingletonComponent.class)
abstract public class SharedPrefModule {
@Binds
public abstract SharedPref bindSharedPref(SharedPrefImpl sharedPrefImpl);
}
@@ -1,13 +0,0 @@
package one.nem.lacerta.data.processor;
import org.eclipse.jgit.lib.Repository;
import one.nem.lacerta.model.document.DocumentDetail;
public interface DocumentProcessor {
// TODO-rca: Initをここでやるべきか検討する?, Documentモデルを作るべきか検討する?
void setDocumentDetail(DocumentDetail documentDetail);
}
@@ -1,4 +0,0 @@
package one.nem.lacerta.data.processor.impl;
public class DocumentProcessorImpl {
}
@@ -0,0 +1,7 @@
package one.nem.lacerta.data.repository;
import one.nem.lacerta.data.model.DeviceMetaModel;
public interface DeviceMeta {
DeviceMetaModel getDeviceMeta();
}
@@ -0,0 +1,15 @@
package one.nem.lacerta.data.repository;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.data.model.documents.DocumentDetail;
import one.nem.lacerta.data.model.documents.DocumentMeta;
public interface Documents {
ArrayList<DocumentMeta> getRecentDocuments(int limit);
ArrayList<DocumentMeta> getStarredDocuments(int limit);
}
@@ -0,0 +1,11 @@
package one.nem.lacerta.data.repository;
import android.content.SharedPreferences;
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
public interface SharedPref {
// タグのTypoを防ぐ為にEnumで管理して取得させるやつ
SharedPreferences getSharedPreferencesByTag(SharedPrefType sharedPrefType);
}
@@ -0,0 +1,60 @@
package one.nem.lacerta.source.pref.impl;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import dagger.hilt.android.qualifiers.ApplicationContext;
import one.nem.lacerta.source.pref.repository.Common;
public class CommonImpl implements Common {
Context applicationContext;
@Inject
public CommonImpl(@ApplicationContext Context applicationContext) {
this.applicationContext = applicationContext;
}
public String getStringValue(String key) {
SharedPreferences pref = applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE);
return pref.getString(key, "");
}
public void setStringValue(String key, String value) {
SharedPreferences pref = applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.putString(key, value);
editor.apply();
}
public boolean isExist(String key) {
SharedPreferences pref = applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE);
return pref.contains(key);
}
public void remove(String key) {
SharedPreferences pref = applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = pref.edit();
editor.remove(key);
editor.apply();
}
public ArrayList<String> getExistKeys() {
SharedPreferences pref = applicationContext.getSharedPreferences("common", Context.MODE_PRIVATE);
// キーだけをArrayListに切り出す
return new ArrayList<>(pref.getAll().keySet());
}
}
@@ -0,0 +1,16 @@
package one.nem.lacerta.source.pref.module;
import dagger.Binds;
import dagger.Module;
import dagger.hilt.InstallIn;
import dagger.hilt.components.SingletonComponent;
import one.nem.lacerta.source.pref.impl.CommonImpl;
import one.nem.lacerta.source.pref.repository.Common;
@Module
@InstallIn(SingletonComponent.class)
abstract public class CommonModule {
@Binds
public abstract Common bindCommon(CommonImpl commonImpl);
}
@@ -0,0 +1,18 @@
package one.nem.lacerta.source.pref.repository;
import java.util.ArrayList;
import java.util.List;
public interface Common {
// さまざまな用途で使うPref
String getStringValue(String key);
void setStringValue(String key, String value);
boolean isExist(String key);
void remove(String key);
ArrayList<String> getExistKeys();
}
+1 -13
View File
@@ -5,7 +5,7 @@ plugins {
android {
namespace 'one.nem.lacerta.feature.debug'
compileSdk 34
compileSdk 33
defaultConfig {
minSdk 26
@@ -45,21 +45,9 @@ dependencies {
implementation libs.com.google.dagger.hilt.android
annotationProcessor libs.com.google.dagger.hilt.compiler
// JGit
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r'
// 内部モジュール
// data
implementation project(':data')
// Debug
implementation project(':source')
implementation project(':utils')
// 型
implementation project(':model')
// Shared
implementation project(':shared:ui')
}
@@ -0,0 +1,24 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class DebugMenuContainerActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_debug_menu_container);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
}
}
@@ -1,67 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import dagger.hilt.android.AndroidEntryPoint;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuContainerFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuContainerFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public DebugMenuContainerFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment DebugMenuSubContainerFragment.
*/
// TODO: Rename and change types and number of parameters
public static DebugMenuContainerFragment newInstance(String param1, String param2) {
DebugMenuContainerFragment fragment = new DebugMenuContainerFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_menu_container, container, false);
}
}
@@ -1,81 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import one.nem.lacerta.data.Document;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuDocumentListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuDocumentListItem;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.utils.LacertaLogger;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocumentTesterListFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuDocumentTesterListFragment extends Fragment {
@Inject
Document document;
@Inject
LacertaLogger logger;
public DebugMenuDocumentTesterListFragment() {
// Required empty public constructor
}
public static DebugMenuDocumentTesterListFragment newInstance() {
DebugMenuDocumentTesterListFragment fragment = new DebugMenuDocumentTesterListFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_document_tester_list, container, false);
RecyclerView recyclerView = view.findViewById(R.id.recycler_view_document_list);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
ArrayList<DocumentMeta> documentMetas = document.getAllDocumentMetas(100);
logger.debug("Debug/DocList", "Document count: " + documentMetas.size());
List<DebugMenuDocumentListItem> debugMenuDocumentListItems = new ArrayList<>();
for (DocumentMeta documentMeta : documentMetas) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
debugMenuDocumentListItems.add(new DebugMenuDocumentListItem(documentMeta.getTitle(), "Internal Id: " + documentMeta.getId(), simpleDateFormat.format(documentMeta.getUpdatedAt())));
}
DebugMenuDocumentListItemAdapter adapter = new DebugMenuDocumentListItemAdapter(debugMenuDocumentListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -1,72 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.material.textfield.TextInputEditText;
import java.util.UUID;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
import dagger.multibindings.IntKey;
import one.nem.lacerta.data.DocumentDebug;
import one.nem.lacerta.model.document.DocumentMeta;
import one.nem.lacerta.model.document.DocumentDetail;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.tag.DocumentTag;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocumentTesterManageFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuDocumentTesterManageFragment extends Fragment {
@Inject
DocumentDebug documentDebug;
public DebugMenuDocumentTesterManageFragment() {
// Required empty public constructor
}
public static DebugMenuDocumentTesterManageFragment newInstance() {
DebugMenuDocumentTesterManageFragment fragment = new DebugMenuDocumentTesterManageFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_document_tester_manage, container, false);
TextInputEditText editTextDocumentTitle = view.findViewById(R.id.edit_text_document_title);
view.findViewById(R.id.button_insert_test_data).setOnClickListener( v -> {
DocumentMeta meta = new DocumentMeta(editTextDocumentTitle != null ? editTextDocumentTitle.getText().toString() : "empty title"); // TODO-rca: Nullable
DocumentPath path = new DocumentPath("root", "test_path");
DocumentDetail detail = new DocumentDetail(meta, path, "test_author", "test_default_branch");
documentDebug.insertDocument(meta, detail);
});
return view;
}
}
@@ -1,59 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuDocumentTesterTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuDocumentTesterTopFragment extends Fragment {
public DebugMenuDocumentTesterTopFragment() {
// Required empty public constructor
}
public static DebugMenuDocumentTesterTopFragment newInstance() {
DebugMenuDocumentTesterTopFragment fragment = new DebugMenuDocumentTesterTopFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_document_tester_top, container, false);
RecyclerView recyclerView = view.findViewById(R.id.debug_menu_document_tester_recycler_view);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
List<DebugMenuListItem> debugMenuDocTesterListItems = new ArrayList<>();
debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentListFragment", "DocumentListFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterListFragment, true));
debugMenuDocTesterListItems.add(new DebugMenuListItem("DocumentManagerFragment", "DocumentManagerFragment", R.id.action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterManageFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuDocTesterListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -0,0 +1,81 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;
import androidx.navigation.ui.NavigationUI;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import dagger.hilt.android.AndroidEntryPoint;
import javax.inject.Inject;
import one.nem.lacerta.data.repository.DeviceMeta;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugMenuFragment extends Fragment {
@Inject
DeviceMeta deviceMeta;
@Inject
public DebugMenuFragment() {
// Required empty public constructor
}
public static DebugMenuFragment newInstance() {
DebugMenuFragment fragment = new DebugMenuFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_menu, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.btn_debug_menu_scan).setOnClickListener( v -> {
// スキャン機能呼び出し
Toast.makeText(getContext(), "testMessage", Toast.LENGTH_SHORT).show();
});
view.findViewById(R.id.btn_debug_menu_shared_pref_editor).setOnClickListener( v -> {
// Fragment移動
Navigation.findNavController(view).navigate(R.id.action_debugMenuFragment_to_debugSharedPrefEditorFragment);
});
view.findViewById(R.id.btn_debug_menu_clear_pref).setOnClickListener( v -> {
// SharedPrefClear
});
view.findViewById(R.id.btn_debug_menu_call_play_ground).setOnClickListener( v -> {
Navigation.findNavController(view).navigate(R.id.action_debugMenuFragment_to_debugPlayGroundFragment);
});
}
}
@@ -1,39 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuMetaDataFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuMetaDataFragment extends Fragment {
public DebugMenuMetaDataFragment() {
// Required empty public constructor
}
public static DebugMenuMetaDataFragment newInstance() {
DebugMenuMetaDataFragment fragment = new DebugMenuMetaDataFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_menu_meta_data, container, false);
}
}
@@ -1,56 +0,0 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import one.nem.lacerta.feature.debug.common.adapter.DebugMenuListItemAdapter;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugMenuTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class DebugMenuTopFragment extends Fragment {
public DebugMenuTopFragment() {
// Required empty public constructor
}
public static DebugMenuTopFragment newInstance() {
DebugMenuTopFragment fragment = new DebugMenuTopFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_debug_menu_top, container, false);
RecyclerView recyclerView = view.findViewById(R.id.debug_menu_recycler_view);
recyclerView.setLayoutManager(new androidx.recyclerview.widget.LinearLayoutManager(getContext()));
List<DebugMenuListItem> debugMenuListItems = new ArrayList<>();
debugMenuListItems.add(new DebugMenuListItem("Meta Data", "View meta data", R.id.action_debugMenuTopFragment_to_debugMenuMetaDataFragment, true));
debugMenuListItems.add(new DebugMenuListItem("Document Tester", "placeholder", R.id.action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment, true));
DebugMenuListItemAdapter adapter = new DebugMenuListItemAdapter(debugMenuListItems);
recyclerView.setAdapter(adapter);
return view;
}
}
@@ -0,0 +1,65 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import one.nem.lacerta.data.repository.Documents;
import one.nem.lacerta.data.repository.SharedPref;
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
@AndroidEntryPoint // HiltのDIを有効にするアノテーション
public class DebugPlayGroundFragment extends Fragment {
@Inject // DI
Documents documents;
@Inject // DI
SharedPref sharedPref;
public DebugPlayGroundFragment() {
// Required empty public constructor
}
public static DebugPlayGroundFragment newInstance() {
DebugPlayGroundFragment fragment = new DebugPlayGroundFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_play_ground, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// ここがいままでのonCreateと同等のものです。
// findViewById(R.id.hoge)とかは view.findViewById(R.id.hoge) と書き換える必要アリ
// (viewは引数として受け取ってるviewなので、別メソッドに切り出したりするなら渡してあげる)
// ShardPrefの要素数をトーストする例
Toast.makeText(getContext(), "SharedPrefの要素数: " + sharedPref.getSharedPreferencesByTag(SharedPrefType.COMMON).getAll().size(), Toast.LENGTH_SHORT).show();
}
}
@@ -0,0 +1,115 @@
package one.nem.lacerta.feature.debug;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import org.w3c.dom.Text;
import java.util.Map;
import one.nem.lacerta.data.model.shared_pref.enums.SharedPrefType;
import one.nem.lacerta.source.pref.repository.Common; //TODO-rca: 名前変えるべきかも
import one.nem.lacerta.data.repository.SharedPref;
import javax.inject.Inject;
import dagger.hilt.android.AndroidEntryPoint;
/**
* A simple {@link Fragment} subclass.
* Use the {@link DebugSharedPrefEditorFragment#newInstance} factory method to
* create an instance of this fragment.
*/
@AndroidEntryPoint
public class DebugSharedPrefEditorFragment extends Fragment {
@Inject
Common prefCommon;
@Inject
SharedPref sharedPref;
SharedPrefType sharedPrefType = null;
public DebugSharedPrefEditorFragment() {
// Required empty public constructor
}
public static DebugSharedPrefEditorFragment newInstance() {
DebugSharedPrefEditorFragment fragment = new DebugSharedPrefEditorFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_debug_shared_pref_editor, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
EditText loadKeyEditText = view.findViewById(R.id.loadKeyEditText);
EditText saveKeyEditText = view.findViewById(R.id.saveKeyEditText);
TextView prefItemTextView = view.findViewById(R.id.prefItemTextView);
view.findViewById(R.id.loadButton).setOnClickListener(v -> {
String value = sharedPref.getSharedPreferencesByTag(sharedPrefType).getString(loadKeyEditText.getText().toString(), "null");
((TextView) view.findViewById(R.id.loadValueTextView)).setText(value);
});
view.findViewById(R.id.saveButton).setOnClickListener(v -> {
String[] split = saveKeyEditText.getText().toString().split(":");
sharedPref.getSharedPreferencesByTag(sharedPrefType).edit().putString(split[0], split[1]).apply();
updateList(prefItemTextView);
});
// ラジオボタンの変更を監視
((RadioGroup) view.findViewById(R.id.radioGroupPrefType)).setOnCheckedChangeListener((group, checkedId) -> {
if (checkedId == R.id.radioButtonCommon) {
sharedPrefType = SharedPrefType.COMMON;
updateList(prefItemTextView);
} else if (checkedId == R.id.radioButtonUserData) {
sharedPrefType = SharedPrefType.USERDATA;
updateList(prefItemTextView);
} else {
Log.e("DebugSharedPrefEditorFragment", "radioButtonのIDが不正です");
}
updateList(prefItemTextView);
});
}
public void updateList(TextView textView) {
// リストの更新
Map<String, ?> resultMap = sharedPref.getSharedPreferencesByTag(sharedPrefType).getAll();
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, ?> entry : resultMap.entrySet()) {
sb.append(entry.getKey()).append(":").append(entry.getValue().toString()).append("\n");
}
textView.setText(sb.toString());
}
}
@@ -1,67 +0,0 @@
package one.nem.lacerta.feature.debug.common.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import one.nem.lacerta.feature.debug.R;
import one.nem.lacerta.feature.debug.common.model.DebugMenuDocumentListItem;
public class DebugMenuDocumentListItemAdapter extends RecyclerView.Adapter<DebugMenuDocumentListItemAdapter.DebugMenuDocumentListItemViewHolder> {
private List<DebugMenuDocumentListItem> debugMenuDocumentListItems;
public DebugMenuDocumentListItemAdapter(List<DebugMenuDocumentListItem> debugMenuDocumentListItems) {
this.debugMenuDocumentListItems = debugMenuDocumentListItems;
}
@NonNull
@Override
public DebugMenuDocumentListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_debug_menu_document, parent, false);
return new DebugMenuDocumentListItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull DebugMenuDocumentListItemViewHolder holder, int position) {
DebugMenuDocumentListItem item = debugMenuDocumentListItems.get(position);
// Set title
holder.title.setText(item.getTitle());
// Set description
holder.description.setText(item.getDescription());
// Set updated at
holder.updatedAt.setText("Updated at: " + item.getUpdatedAt());
holder.itemView.setOnClickListener(v -> {
Toast.makeText(v.getContext(), "Clicked on " + item.getTitle(), Toast.LENGTH_SHORT).show(); // Debug
});
}
@Override
public int getItemCount() {
return debugMenuDocumentListItems.size();
}
public class DebugMenuDocumentListItemViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
TextView updatedAt;
public DebugMenuDocumentListItemViewHolder(@NonNull View itemView) {
super(itemView);
title = itemView.findViewById(R.id.document_list_item_title);
description = itemView.findViewById(R.id.document_list_item_description);
updatedAt = itemView.findViewById(R.id.document_list_item_updated_at);
}
}
}
@@ -1,63 +0,0 @@
package one.nem.lacerta.feature.debug.common.adapter;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.navigation.Navigation;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import one.nem.lacerta.feature.debug.R;
import one.nem.lacerta.feature.debug.common.model.DebugMenuListItem;
import one.nem.lacerta.utils.LacertaLogger;
public class DebugMenuListItemAdapter extends RecyclerView.Adapter<DebugMenuListItemAdapter.DebugMenuListItemViewHolder> {
private List<DebugMenuListItem> debugMenuListItems;
public DebugMenuListItemAdapter(List<DebugMenuListItem> debugMenuListItems) {
this.debugMenuListItems = debugMenuListItems;
}
@NonNull
@Override
public DebugMenuListItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_debug_menu, parent, false);
return new DebugMenuListItemViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull DebugMenuListItemViewHolder holder, int position) {
DebugMenuListItem item = debugMenuListItems.get(position);
// Set title
holder.title.setText(item.getTitle());
// Set description
holder.description.setText(item.getDescription());
holder.itemView.setOnClickListener( v -> {
Navigation.findNavController(v).navigate(item.getDestinationId());
});
}
@Override
public int getItemCount() {
return debugMenuListItems.size();
}
static class DebugMenuListItemViewHolder extends RecyclerView.ViewHolder {
TextView title;
TextView description;
public DebugMenuListItemViewHolder(@NonNull View itemView) {
super(itemView);
// Get ref to views
title = itemView.findViewById(R.id.debug_menu_item_title);
description = itemView.findViewById(R.id.debug_menu_item_description);
}
}
}
@@ -1,27 +0,0 @@
package one.nem.lacerta.feature.debug.common.model;
public class DebugMenuDocumentListItem {
private String title;
private String description;
private String updatedAt;
public DebugMenuDocumentListItem(String title, String description, String updatedAt) {
this.title = title;
this.description = description;
this.updatedAt = updatedAt;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public String getUpdatedAt() {
return updatedAt;
}
}
@@ -1,38 +0,0 @@
package one.nem.lacerta.feature.debug.common.model;
public class DebugMenuListItem {
private String title;
private String description;
private int destinationId; // Navigation destination ID
private boolean enabled;
public DebugMenuListItem(String title, String description, int destinationId, boolean enabled) {
this.title = title;
this.description = description;
this.destinationId = destinationId;
this.enabled = enabled;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public int getDestinationId() {
return destinationId;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
@@ -2,16 +2,22 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuDocumentTesterListFragment" >
tools:context=".DebugMenuContainerActivity">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view_document_list"
android:layout_width="match_parent"
android:layout_height="0dp"
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragmentContainerView"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="409dp"
android:layout_height="729dp"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/feature_debug_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".DebugMenuFragment">
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Debug Menu"
android:textSize="36sp"
android:padding="16dp" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- Call Events -->
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Call Debug Events"
android:textSize="24sp"
android:padding="8dp" />
<!-- android:textColor="@color/material_dynamic_primary10" />-->
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_debug_menu_scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Start scan action"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp" />
<!-- Padding -->
<View
android:layout_width="match_parent"
android:layout_height="16dp" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="SharedPref"
android:textSize="24sp" />
<!-- android:textColor="@color/material_dynamic_primary10" />-->
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_debug_menu_clear_pref"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Clear Preferences"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_debug_menu_shared_pref_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Shared Preferences Editor"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="8dp" />
<!-- Padding -->
<View
android:layout_width="match_parent"
android:layout_height="16dp" />
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text="SharedPref"
android:textSize="24sp" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_debug_menu_call_play_ground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:text="Playground" />
</LinearLayout>
</ScrollView>
</LinearLayout>
@@ -1,35 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".DebugMenuContainerFragment" >
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/debug_menu_top_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimaryContainer"
app:titleTextColor="@color/colorOnPrimaryContainer"
app:title="Debug Menu"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.fragment.app.FragmentContainerView
android:id="@+id/fragmentContainerView"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_top_toolbar"
app:navGraph="@navigation/feature_debug_internal_navigation" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuDocumentTesterManageFragment" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="16dp"
android:background="@drawable/rounded_secondary_container">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:textSize="16sp"
android:textColor="@color/colorOnSecondaryContainer"
android:text="Debug actions" />
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Document title"
android:id="@+id/edit_text_document_title"
android:layout_margin="16dp"
android:inputType="text"
android:textSize="16sp"
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox" />
<com.google.android.material.button.MaterialButton
android:id="@+id/button_insert_test_data"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:text="Insert test data"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".DebugMenuDocumentTesterTopFragment">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/debug_menu_document_tester_recycler_view"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DebugMenuMetaDataFragment">
<!-- TODO: Update blank fragment layout -->
</FrameLayout>
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".DebugMenuTopFragment" >
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/debug_menu_recycler_view"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,14 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeTopFragment">
android:orientation="vertical"
tools:context=".DebugPlayGroundFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".DebugSharedPrefEditorFragment">
<RadioGroup
android:id="@+id/radioGroupPrefType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/radioButtonCommon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Common" />
<RadioButton
android:id="@+id/radioButtonUserData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="UserData" />
</RadioGroup>
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Save pref" />
<LinearLayout
android:id="@+id/SaveLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="@+id/saveKeyEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="2"
android:hint="Key:Value" />
<com.google.android.material.button.MaterialButton
android:id="@+id/saveButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Load pref" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/LoadLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="@+id/loadKeyEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:hint="Key" />
<com.google.android.material.button.MaterialButton
android:id="@+id/loadButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Load" />
</LinearLayout>
<TextView
android:id="@+id/loadValueTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="No value..."
android:textSize="24sp" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/prefItemTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="None" />
</LinearLayout>
</ScrollView>
</LinearLayout>
@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/debug_menu_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/debug_menu_item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/debug_menu_item_title" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,38 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="16dp">
<TextView
android:id="@+id/document_list_item_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="TITLE"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/document_list_item_updated_at"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/document_list_item_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="DESCRIPTION"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/document_list_item_title" />
<TextView
android:id="@+id/document_list_item_updated_at"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="14sp"
android:text="Updated at: aaaaaaaaaa"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feature_debug_internal_navigation"
app:startDestination="@id/debugMenuTopFragment">
<fragment
android:id="@+id/debugMenuTopFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuTopFragment"
android:label="fragment_debug_menu_top"
tools:layout="@layout/fragment_debug_menu_top" >
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuMetaDataFragment"
app:destination="@id/debugMenuMetaDataFragment" />
<action
android:id="@+id/action_debugMenuTopFragment_to_debugMenuDocumentTesterTopFragment"
app:destination="@id/debugMenuDocumentTesterTopFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuMetaDataFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuMetaDataFragment"
android:label="fragment_debug_menu_meta_data"
tools:layout="@layout/fragment_debug_menu_meta_data" />
<fragment
android:id="@+id/debugMenuDocumentTesterTopFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterTopFragment"
android:label="fragment_debug_menu_document_tester_top"
tools:layout="@layout/fragment_debug_menu_document_tester_top" >
<action
android:id="@+id/action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterListFragment"
app:destination="@id/debugMenuDocumentTesterListFragment" />
<action
android:id="@+id/action_debugMenuDocumentTesterTopFragment_to_debugMenuDocumentTesterManageFragment"
app:destination="@id/debugMenuDocumentTesterManageFragment" />
</fragment>
<fragment
android:id="@+id/debugMenuDocumentTesterListFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterListFragment"
android:label="fragment_debug_menu_document_tester_list"
tools:layout="@layout/fragment_debug_menu_document_tester_list" />
<fragment
android:id="@+id/debugMenuDocumentTesterManageFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuDocumentTesterManageFragment"
android:label="fragment_debug_menu_document_tester_manage"
tools:layout="@layout/fragment_debug_menu_document_tester_manage" />
</navigation>
@@ -3,10 +3,28 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feature_debug_navigation"
app:startDestination="@id/debugMenuContainerFragment">
app:startDestination="@id/debugMenuFragment">
<fragment
android:id="@+id/debugMenuContainerFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuContainerFragment"
android:label="fragment_debug_menu_container"
tools:layout="@layout/fragment_debug_menu_container" />
android:id="@+id/debugMenuFragment"
android:name="one.nem.lacerta.feature.debug.DebugMenuFragment"
android:label="fragment_debug_menu"
tools:layout="@layout/fragment_debug_menu" >
<action
android:id="@+id/action_debugMenuFragment_to_debugSharedPrefEditorFragment"
app:destination="@id/debugSharedPrefEditorFragment" />
<action
android:id="@+id/action_debugMenuFragment_to_debugPlayGroundFragment"
app:destination="@id/debugPlayGroundFragment" />
</fragment>
<fragment
android:id="@+id/debugSharedPrefEditorFragment"
android:name="one.nem.lacerta.feature.debug.DebugSharedPrefEditorFragment"
android:label="fragment_debug_shared_pref_editor"
tools:layout="@layout/fragment_debug_shared_pref_editor" />
<fragment
android:id="@+id/debugPlayGroundFragment"
android:name="one.nem.lacerta.feature.debug.DebugPlayGroundFragment"
android:label="fragment_debug_play_ground"
tools:layout="@layout/fragment_debug_play_ground" />
</navigation>
+5 -13
View File
@@ -27,17 +27,9 @@ android {
dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
// Navigation
implementation libs.navigation.fragment
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
// shared
implementation project(':shared:ui')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
@@ -1,64 +0,0 @@
package one.nem.lacerta.feature.home;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link HomeTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class HomeTopFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public HomeTopFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment HomeTopFragment.
*/
// TODO: Rename and change types and number of parameters
public static HomeTopFragment newInstance(String param1, String param2) {
HomeTopFragment fragment = new HomeTopFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_home_top, container, false);
}
}
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feature_home_navigation"
app:startDestination="@id/homeTopFragment">
<fragment
android:id="@+id/homeTopFragment"
android:name="one.nem.lacerta.feature.home.HomeTopFragment"
android:label="fragment_home_top"
tools:layout="@layout/fragment_home_top" />
</navigation>
@@ -1,4 +0,0 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
+5 -11
View File
@@ -27,15 +27,9 @@ android {
dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
// Navigation
implementation libs.navigation.fragment
implementation libs.navigation.ui
implementation libs.navigation.dynamic.features.fragment
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
@@ -1,64 +0,0 @@
package one.nem.lacerta.feature.library;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link LibraryTopFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class LibraryTopFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public LibraryTopFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment LibraryTopFragment.
*/
// TODO: Rename and change types and number of parameters
public static LibraryTopFragment newInstance(String param1, String param2) {
LibraryTopFragment fragment = new LibraryTopFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_library_top, container, false);
}
}
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".LibraryTopFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feature_library_navigation"
app:startDestination="@id/feature_library_top_fragment">
<fragment
android:id="@+id/feature_library_top_fragment"
android:name="one.nem.lacerta.feature.library.LibraryTopFragment"
android:label="fragment_library_top"
tools:layout="@layout/fragment_library_top" />
</navigation>
@@ -1,4 +0,0 @@
<resources>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>
-1
View File
@@ -1 +0,0 @@
/build
-39
View File
@@ -1,39 +0,0 @@
plugins {
alias(libs.plugins.com.android.library)
}
android {
namespace 'one.nem.lacerta.model'
compileSdk 34
defaultConfig {
minSdk 26
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation libs.androidx.appcompat
implementation libs.com.google.android.material
testImplementation libs.junit
androidTestImplementation libs.androidx.test.ext.junit
androidTestImplementation libs.androidx.test.espresso.core
// JGit
implementation 'org.eclipse.jgit:org.eclipse.jgit:6.8.0.202311291450-r'
}
View File
Whitespace-only changes.
-21
View File
@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -1,26 +0,0 @@
package one.nem.lacerta.model;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("one.nem.lacerta.model.test", appContext.getPackageName());
}
}
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
@@ -1,128 +0,0 @@
package one.nem.lacerta.model.document;
import org.eclipse.jgit.lib.Repository;
import java.nio.file.Path;
import java.util.Date;
import one.nem.lacerta.model.document.path.DocumentPath;
import one.nem.lacerta.model.document.DocumentMeta;
/**
* ドキュメントの詳細データ
*/
public class DocumentDetail {
/**
* ドキュメントのメタデータ(DocumentMetaインスタンス)
*/
DocumentMeta meta;
/**
* ドキュメントのパス(DocumentPathインスタンス)
*/
DocumentPath path;
/**
* ドキュメントの作者(String)
*/
String author;
/**
* ドキュメントのデフォルトブランチ(String)
*/
String defaultBranch;
Repository repository;
// Constructor
public DocumentDetail() {
}
public DocumentDetail(DocumentMeta meta, DocumentPath path, String author, String defaultBranch) {
this.meta = meta;
this.path = path;
this.author = author;
this.defaultBranch = defaultBranch;
}
// Getter
/**
* ドキュメントのメタデータ(DocumentMetaインスタンス)を取得する
*/
public DocumentMeta getMeta() {
return meta;
}
/**
* ドキュメントのパス(DocumentPathインスタンス)を取得する
*/
public DocumentPath getPath() {
return path;
}
/**
* ドキュメントの作者(String)を取得する
*/
public String getAuthor() {
return author;
}
/**
* ドキュメントのデフォルトブランチ(String)を取得する
*/
public String getDefaultBranch() {
return defaultBranch;
}
/**
* ドキュメントのリポジトリを取得する
*/
public Repository getRepository() {
return repository;
}
// Setter
/**
* ドキュメントのメタデータ(DocumentMetaインスタンス)を設定する
* @param meta DocumentMetaインスタンス
*/
public void setMeta(DocumentMeta meta) {
this.meta = meta;
}
/**
* ドキュメントのパス(DocumentPathインスタンス)を設定する
* @param path DocumentPathインスタンス
*/
public void setPath(DocumentPath path) {
this.path = path;
}
/**
* ドキュメントの作者(String)を設定する
* @param author ドキュメントの作者
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* ドキュメントのデフォルトブランチ(String)を設定する
* @param defaultBranch ドキュメントのデフォルトブランチ
*/
public void setDefaultBranch(String defaultBranch) {
this.defaultBranch = defaultBranch;
}
/**
* ドキュメントのリポジトリを設定する
*/
public void setRepository(Repository repository) {
this.repository = repository;
}
}
@@ -1,179 +0,0 @@
package one.nem.lacerta.model.document;
import java.util.ArrayList;
import one.nem.lacerta.model.document.tag.DocumentTag;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* ドキュメントのメタデータ
*/
public class DocumentMeta {
/**
* ドキュメントのID(String)
*/
String id;
/**
* ドキュメントのタイトル(String)
*/
String title;
/**
* ドキュメントの更新日時(Date)
*/
Date updatedAt;
/**
* ドキュメントの作成日時(Date)
*/
Date createdAt;
/**
* ドキュメントのタグ(DocumentTagインスタンスのリスト)
*/
List<DocumentTag> tags;
// Constructor
public DocumentMeta() {
}
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt, List<DocumentTag> tags) { // With all
this.id = id;
this.title = title;
this.updatedAt = updatedAt;
this.createdAt = createdAt;
this.tags = tags;
}
public DocumentMeta(String id, String title, Date updatedAt, Date createdAt) { // Without tags
this.id = id;
this.title = title;
this.updatedAt = updatedAt;
this.createdAt = createdAt;
this.tags = new ArrayList<>();
}
public DocumentMeta(String id, String title) { // Without tags, updatedAt, createdAt
this.id = id;
this.title = title;
// 現在時刻を設定
this.updatedAt = new Date();
this.createdAt = new Date();
this.tags = new ArrayList<>();
}
public DocumentMeta(String title) { // title only
this.id = UUID.randomUUID().toString(); // 新規作成時想定なのでコンストラクタで生成してしまう(使う人が楽なので)
this.title = title;
// 現在時刻を設定
this.updatedAt = new Date();
this.createdAt = new Date();
this.tags = new ArrayList<>();
}
// Getter
/**
* ドキュメントのID(String)を取得する
*/
public String getId() {
return id;
}
/**
* ドキュメントのタイトル(String)を取得する
*/
public String getTitle() {
return title;
}
/**
* ドキュメントの更新日時(Date)を取得する
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* ドキュメントの作成日時(Date)を取得する
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* ドキュメントのタグ(DocumentTagインスタンスのリスト)を取得する
*/
public List<DocumentTag> getTags() {
return tags;
}
/**
* ドキュメントのタグ(DocumentTagインスタンスのリスト)のID(String)を取得する
*/
public List<String> getTagIds() {
List<String> tagIds = new ArrayList<>();
for (DocumentTag tag : tags) {
tagIds.add(tag.getId());
}
return tagIds;
}
// Setter
/**
* ドキュメントのID(String)を設定する
* @param id ドキュメントのID
*/
public void setId(String id) {
this.id = id;
}
/**
* ドキュメントのタイトル(String)を設定する
* @param title ドキュメントのタイトル
*/
public void setTitle(String title) {
this.title = title;
}
/**
* ドキュメントの更新日時(Date)を設定する
* @param updatedAt ドキュメントの更新日時
*/
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
/**
* ドキュメントの作成日時(Date)を設定する
* @param createdAt ドキュメントの作成日時
*/
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
/**
* ドキュメントのタグ(DocumentTagインスタンスのリスト)を設定する
* @param tags ドキュメントのタグ(DocumentTagインスタンスのリスト)
*/
public void setTags(List<DocumentTag> tags) {
this.tags = tags;
}
/**
* updatedAtを現在時刻に設定する
*/
public void setUpdatedAtNow() {
this.updatedAt = new Date();
}
/**
* createdAtを現在時刻に設定する
*/
public void setCreatedAtNow() {
this.createdAt = new Date();
}
}
@@ -1,80 +0,0 @@
package one.nem.lacerta.model.document.path;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* ドキュメントのパス
*/
public class DocumentPath {
/**
* ドキュメントのルートパス(String)
*/
String rootPath;
/**
* ドキュメントのパス(String)
*/
String path;
// Constructor
public DocumentPath() {
}
public DocumentPath(String rootPath, String path) {
this.rootPath = rootPath;
this.path = path;
}
// Getter
/**
* ドキュメントのルートパス(String)を取得する
*/
public String getRootPath() {
return rootPath;
}
/**
* ドキュメントのパス(String)を取得する
*/
public String getPath() {
return path;
}
/**
* ドキュメントのフルパス(Path)を取得する
*/
public Path getFullPath() {
// rootPathとpathを結合して返す
return Paths.get(rootPath, path);
}
/**
* ドキュメントのフルパス(String)を取得する
*/
public String getFullPathString() {
// rootPathとpathを結合して返す
return Paths.get(rootPath, path).toString();
}
// Setter
/**
* ドキュメントのルートパス(String)を設定する
* @param rootPath ドキュメントのルートパス
*/
public void setRootPath(String rootPath) {
this.rootPath = rootPath;
}
/**
* ドキュメントのパス(String)を設定する
* @param path ドキュメントのパス
*/
public void setPath(String path) {
this.path = path;
}
}
@@ -1,82 +0,0 @@
package one.nem.lacerta.model.document.tag;
/**
* ドキュメントのタグ
*/
public class DocumentTag {
/**
* タグのID(String)
*/
String id;
/**
* タグの名前(String)
*/
String name;
/**
* タグの色(String)
*/
String color;
// Constructor
public DocumentTag() {
}
public DocumentTag(String id, String name, String color) {
this.id = id;
this.name = name;
this.color = color;
}
// Getter
/**
* タグのID(String)を取得する
*/
public String getId() {
return id;
}
/**
* タグの名前(String)を取得する
*/
public String getName() {
return name;
}
/**
* タグの色(String)を取得する
*/
public String getColor() {
return color;
}
// Setter
/**
* タグのID(String)を設定する
* @param id タグのID
*/
public void setId(String id) {
this.id = id;
}
/**
* タグの名前(String)を設定する
* @param name タグの名前
*/
public void setName(String name) {
this.name = name;
}
/**
* タグの色(String)を設定する
* @param color タグの色
*/
public void setColor(String color) {
this.color = color;
}
}
@@ -1 +0,0 @@
Deviceのメタデータ, アプリのメタデータとかの型を書く(そのうち)
@@ -1,17 +0,0 @@
package one.nem.lacerta.model;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
-1
View File
@@ -1 +0,0 @@
/build
Loaded 100 of 186 files, more files were not shown because too many files have changed in this diff. Show more