Compare commits

...
Author SHA1 Message Date
r-ca 3a979b7dab WIP 2024-01-19 17:18:34 +09:00
r-ca f1d8a3341e padding追加 2024-01-19 16:59:12 +09:00
r-ca 462495b173 radius変更 2024-01-19 16:53:36 +09:00
r-ca 74d1011412 fix 2024-01-19 16:53:15 +09:00
r-ca 52d2a244a0 WIP 2024-01-19 16:36:44 +09:00
r-ca 1b050f5d3c リソースファイル追加tuika 2024-01-19 16:19:17 +09:00
r-ca 2cec483288 MaterialToolBarへ変更 2024-01-19 16:16:49 +09:00
r-ca 10019cb86b タイトルを中央へ WIP 2024-01-19 16:12:41 +09:00
r-ca 83806e0d90 仮置きアイテム追加 2024-01-19 16:08:50 +09:00
r-ca 30661e1a2b 実装テスト 2024-01-19 16:08:41 +09:00
r-ca 26326024e0 仮置き用リソース追加 2024-01-19 16:06:44 +09:00
r-ca b0bd74af5a 全体のUIを修正 WIP 2024-01-19 16:04:10 +09:00
ろむねこ 9ad6a6291d Merge pull request #82 from lacerta-doc/improve/extract_resource_1
テキストリソースを抽出 1
2024-01-19 15:32:45 +09:00
r-ca 4235030986 外部リソースを使うように 2024-01-19 15:27:51 +09:00
r-ca c60fedeb87 WIP 2024-01-19 15:26:57 +09:00
r-ca 2f18134581 WIP 2024-01-19 15:25:28 +09:00
ろむねこ 4101f75685 Merge pull request #81 from lacerta-doc/refactor/refactor1
リファクタリング
2024-01-19 15:20:52 +09:00
8 changed files with 134 additions and 32 deletions

No files matched your search

@@ -1,7 +1,10 @@
package one.nem.lacerta;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.FragmentManager;
import androidx.navigation.NavController;
import androidx.navigation.fragment.NavHostFragment;
@@ -10,11 +13,14 @@ import androidx.navigation.ui.NavigationUI;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.shape.CornerFamily;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
import dagger.hilt.android.AndroidEntryPoint;
@@ -46,5 +52,38 @@ public class MainActivity extends AppCompatActivity {
// Set navigation bar color
getWindow().setNavigationBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurfaceVariant));
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// // Create a new TextView
// TextView toolbarTitle = new TextView(this);
// // Set the text and center it in the TextView
// toolbarTitle.setText("App Name");
// toolbarTitle.setTextColor(Color.WHITE);
// toolbarTitle.setTextSize(20);
// toolbarTitle.setLayoutParams(new Toolbar.LayoutParams(Toolbar.LayoutParams.WRAP_CONTENT,
// Toolbar.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL));
//
// // Set the TextView as the title
// toolbar.addView(toolbarTitle);
float radius = getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius);
MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable)toolbar.getBackground();
materialShapeDrawable.setShapeAppearanceModel(materialShapeDrawable.getShapeAppearanceModel()
.toBuilder()
.setAllCorners(CornerFamily.ROUNDED,radius)
.build());
// Set the MaterialShapeDrawable as the background of the Toolbar
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
drawer.addDrawerListener(toggle);
toggle.syncState();
// Set the app name in the middle of the toolbar
getSupportActionBar().setTitle("App Name");
}
}
+54 -22
View File
@@ -1,32 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.drawerlayout.widget.DrawerLayout 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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.Lacerta"
tools:context=".MainActivity">
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:navGraph="@navigation/main_nav"
tools:layout="@layout/fragment_debug_menu_container" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu"/>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent">
</androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?attr/colorSecondaryContainer"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_margin="8dp"
app:titleCentered="true" />
</com.google.android.material.appbar.AppBarLayout>
<androidx.fragment.app.FragmentContainerView
android:id="@+id/nav_host_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="0dp"
android:layout_height="0dp"
app:defaultNavHost="true"
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/app_bar_layout"
app:navGraph="@navigation/main_nav"
tools:layout="@layout/fragment_debug_menu_container" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_nav"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="@menu/bottom_nav_menu"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- NavigationView for the navigation drawer -->
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/drawer_menu" />
</androidx.drawerlayout.widget.DrawerLayout>
+4 -4
View File
@@ -4,21 +4,21 @@
<item
android:id="@id/feature_home_navigation"
android:icon="@drawable/home_24px"
android:title="Home"/>
android:title="@string/home_title"/>
<item
android:id="@id/feature_search_navigation"
android:icon="@drawable/search_24px"
android:title="Search"/>
android:title="@string/search_title"/>
<item
android:id="@id/feature_library_navigation"
android:icon="@drawable/folder_24px"
android:title="Library"/>
android:title="@string/library_title"/>
<item
android:id="@id/feature_debug_navigation"
android:icon="@drawable/developer_mode_24px"
android:title="Debug menu"/>
android:title="@string/debug_menu_title"/>
</menu>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:icon="@drawable/developer_mode_24px"
android:title="@string/placeholder" />
</menu>
@@ -4,7 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".HomeTopFragment"
tools:ignore="ExtraText">
tools:ignore="ExtraText"
android:background="@color/colorSurface">
<!-- TODO: Update blank fragment layout -->
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="toolbar_corner_radius">32dp</dimen>
</resources>
+20
View File
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- home -->
<string name="home_title">ホーム</string>
<!-- search -->
<string name="search_title">検索</string>
<!-- library -->
<string name="library_title">ライブラリ</string>
<!-- debug -->
<string name="debug_menu_title">デバッグメニュー</string>
<!-- common -->
<!-- for placeholder -->
<string name="placeholder">Placeholder(TODO: Replace)</string>
</resources>
@@ -1,4 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
</resources>
<resources></resources>