Git Product home page Git Product logo

androiddevelopment's Introduction

Hi, My name is Kotaro Kamashima!

I am from Japan, where I am currently residing. I primarily engage in mobile application development, with a strong proficiency in Android development and the Flutter framework.

Feel free to take a look at my resume below if you'd like to learn more about me.

https://kotaro666-dev.github.io/resume/


Anurag's GitHub stats Top Langs


My skill

androiddevelopment's People

Contributors

kotaro666-dev avatar

Watchers

 avatar

androiddevelopment's Issues

BottomNavigationBar

BottomNavigationViewコンポーネント

懸念点

ここで注意したいのが、Fragmentの切り替え方です。Web上で見つかるコードは、以下のようなreplaceで書かれていることが多いですが、replaceで切り替えると、表示ごとにFragmentの状態が初期化されてしまうため、各アイテムの状態を保つことができません。replaceは内部的にremove、addを行っているためです。

BottomNavigationViewの各メニューアイテムはそれぞれフラグメントで作成し、かつ状態を保持したい。

こちらの資料で紹介されている、「FragmentPagerAdapterを継承したViewPagerクラス」を活用した方法で解決できそう。

FragmentPagerAdapter

Implementation of PagerAdapter that represents each page as a Fragment that is persistently kept in the fragment manager as long as the user can return to the page.

FragmentPagerAdapter

こちらの FragemntPagerAdapterは Depricated されているようで、ViewPager2FragmentStateAdapter を使用するように公式でアナウンスされている。

FragmentStateAdapterを使った実装

以下の資料が参考になりそう。

BottomNavigationView と ViewPager2 を使って、フラグメント再生成を行った場合のデメリット

各フラグメントのインスタンス化は、FragmentStateAdapter が MainAcitivity でインスタンス可されるときに実行される。
そのため、初めてフラグメントのページに訪問した時にインスタンス可されない。

そのことから、例としてホーム画面が生成された時に各画面のフラグメントのインスタンスが生成されてしまうため、各画面にて行いたいAPI通信が最初にすべて実行されてしまう問題がある。'

saveFragmentInstanceState を使って、各フラグメントの状態を保持しておく

以下の記事を参考にする

参考資料

Show/Hide

各画面の状態は維持しておきたい場合などはViewPagerと連動させたりShow/Hideで切り替えることを選ぶと良さそう。

【Android】Fragmentを使うときのコツとか色々

Fragmentをhideすることは、アプリのパフォーマンス的にあまり良くないとのこと

It just hides the views, fragment is still in RESUMED state 🤯🤯🤯🤯

FragmentTransaction.hide()- findings

参考資料

アニメーション

画面をスクロールした時に、アニメーションでAppBarを生成するようにしてほしい

ドット付きカルーセルページビュー

方針

方針として、カルーセルページビューはカスタムダイアログ内で使用するイメージ。
ドットはページビュー下部に設置する予定。
また、左右にスワイプすることができる。

ViewPager2 を使う

懸念点

ViewPager2で左右にスワイプした時に、各フラグメント内のインスタンスが初期化されてしまう可能性あり。

参考資料

RecyclerViewを使った実装

RecyclerView

ListView の後継的存在。
RecyclerView.Adapter クラスとViewHolder クラスを使って、ロジックとViewを切り離して ListViewを作成できる。

参考サイト

Concatenate Adapters

一つの RecyclerView の中に、複数の Adapter を設置することができる。
Flutter の SilverListのようなものか。

参考サイト

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.