Koltin35,头条android面试算法

fun getBusinessInfo() {

val businessCall = takeoutService.getBusinessInfo()

businessCall.enqueue(callback)

}

override fun parserJson(json: String) {

val gson = Gson()

val jsoObj = JSONObject(json)

val allStr = jsoObj.getString(“list”)

//商品类型的集合

goodstypeList = gson.fromJson(allStr, object : TypeToken<List>() {

}.type)

Log.e(“business”, “该商家一共有” + goodstypeList.size + “个类别商品”)

goodsFragment.onLoadBusinessSuccess(goodstypeList)

}

}

GoodsTypeInfo.kt商品的bean

package com.example.takeout.model.beans

class GoodsTypeInfo {

var id: Int = 0//商品类型id

var name: String = “”//商品类型名称

var info: String = “”//特价信息

var list: List = listOf()//商品列表

constructor() : super() {}

constructor(id: Int, name: String, info: String, list: List) : super() {

this.id = id

this.name = name

this.info = info

this.list = list

}

override fun toString(): String {

return “GoodsTypeInfo [id= i d , n a m e = id, name= id,name=name, info= i n f o , l i s t = info, list= info,list=list]”

}

var redDotCount: Int = 0

}

GoodsTypeRvAdapter.kt商品左侧主界面的RecycleView,其中使用FragmentActivity?来作为androidx下面的Context

package com.example.takeout.ui.adapter

import android.view.LayoutInflater

import android.view.View

import android.view.ViewGroup

import android.widget.TextView

import androidx.fragment.app.FragmentActivity

import androidx.recyclerview.widget.RecyclerView

import com.example.takeout.R

import com.example.takeout.model.beans.GoodsTypeInfo

import com.example.takeout.ui.fragment.GoodsFragment

import org.jetbrains.anko.find

class GoodsTypeRvAdapter(val context: FragmentActivity?, val goodsFragment: GoodsFragment) :

RecyclerView.Adapter<RecyclerView.ViewHolder>() {

var goodsTypeList: List = listOf()

fun setDatas(list: List) {

this.goodsTypeList = list

notifyDataSetChanged()

}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {

val itemView = LayoutInflater.from(context).inflate(R.layout.item_type, parent, false)

return GoodsTypeItemHolder(itemView)

}

override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {

val goodsTypeItemHolder = holder as GoodsTypeItemHolder

goodsTypeItemHolder.bindData(goodsTypeList.get(position), position)

}

override fun getItemCount(): Int {

return goodsTypeList.size

}

inner class GoodsTypeItemHolder(val item: View) : RecyclerView.ViewHolder(item) {

val tvType: TextView

init {

tvType = item.find(R.id.type)

}

fun bindData(goodsTypeInfo: GoodsTypeInfo, position: Int) {

tvType.text = goodsTypeInfo.name

}

}

}

TakeoutService.kt服务端的请求格式

package com.example.takeout.model.net

import retrofit2.Call

import retrofit2.http.GET

import rx.Observable

interface TakeoutService {

//ex. @GET(“users/{user}/repos”)

//ex. fun listRepos(@Path(“user”) user: String): Call<List>

//http://127.0.0.1:8090/takeout?index=0

@GET(“takeout?index=0”)

fun getHomeInfo(): Call

//http://127.0.0.1:8090/takelogin?index=0

@GET(“takelogin?index=0”)

fun loginByPhone(): Call

//http://127.0.0.1:8090/takeorder?index=0

@GET(“takeorder?index=0”)

fun getOrderList(): Call

//使用Rxjava组合的接口

//http://127.0.0.1:8090/takeorder?index=0

@GET(“takeorder?index=0”)

fun getOrderListByRxjava(): Observable

@GET(“takebusiness?index=0”)

fun getBusinessInfo(): Call

}

item_type.xml布局文件

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”

android:layout_width=“match_parent”

android:clickable=“true”

android:layout_height=“wrap_content”

最后

都说三年是程序员的一个坎,能否晋升或者提高自己的核心竞争力,这几年就十分关键。

技术发展的这么快,从哪些方面开始学习,才能达到高级工程师水平,最后进阶到Android架构师/技术专家?我总结了这 5大块;

我搜集整理过这几年阿里,以及腾讯,字节跳动,华为,小米等公司的面试题,把面试的要求和技术点梳理成一份大而全的“ Android架构师”面试 Xmind(实际上比预期多花了不少精力),包含知识脉络 + 分支细节。

Android架构视频+BAT面试专题PDF+学习笔记​》

网上学习 Android的资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。希望**这份系统化的技术体系**对大家有一个方向参考。

F-1644918297184)]

网上学习 Android的资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。希望**这份系统化的技术体系**对大家有一个方向参考。

2021年虽然路途坎坷,都在说Android要没落,但是,不要慌,做自己的计划,学自己的习,竞争无处不在,每个行业都是如此。相信自己,没有做不到的,只有想不到的。祝大家2021年万事大吉。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值