Giter Club home page Giter Club logo

android_pattern's People

Contributors

ganghee avatar

Watchers

 avatar  avatar

android_pattern's Issues

2-2 ViewHolder와 Data Class는 변수형이 var인가 val인가?

class UpbitHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    var coinName: TextView = itemView.tv_coin_name
    var tradePrice: TextView = itemView.tv_trade_price
    var signedChangeRate: TextView = itemView.tv_signed_change_rate
    var accTradePrice24th: TextView = itemView.tv_acc_trade_price_24h

...
}

1-3. text의 색이 바뀌지 않는다.

//색이 바뀌지 않음
        if(dataList[position].signed_change_rate > 0){
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.diff_up)
        }else if (dataList[position].signed_change_rate < 0){
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.diff_down)
        }else{
            holder.signed_change_rate.textColor = ContextCompat.getColor(ctx, R.color.black)

6-2 lateinit과 lazy 초기화 중 어느것을 써야할까?

변수를 초기화 할 때

lateinit var sampleAdapter: SampleAdapter
...
sampleAdapter = SampleAdapter(ImageLoaderAdapterViewModel(this,3)
val sampleAdapter: SampleAdapter by lazy {
	SampleAdapter(ImageLoaderAdapterViewModel(this, 3))
}

어느 것을 쓰는 게 맞을까?

2-4 RecyclerView setup하는 시점은 언제인가?

    @SuppressLint("CheckResult")
    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)

        repository.getMarket()
            .subscribe { it ->
                repository.getTicker(it)
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .map {
                        it.filter {TickerResponse ->
                            TickerResponse.market.split("-")[0] == firstMarket
                        }
                    }
                    .subscribe({
                        displayData(it)
                    }, {
                    })
            }
    }
    private fun displayData(posts: List<TickerResponse>?) {
        posts?.let {
            val tickerList = mutableListOf<FormatTickers>()
            posts.forEach{
                tickerList.add(
                    it.toTicker(requireContext())
                )
            }
            rv_tickers.adapter = TickerAdapter(ctx, tickerList)
            rv_tickers.layoutManager = LinearLayoutManager(context, RecyclerView.VERTICAL, false)
        }
    }

2-1 Adapter에 ViewHolder를 구현해야 하나?

class TickerAdapter(private var ctx: Context, private var dataList: List<TickerResponse>) :
    RecyclerView.Adapter<TickerAdapter.Holder>() {
...
        override fun onBindViewHolder(holder: Holder, position: Int) {
...
    }
...
}

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.