-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgradlew
61 lines (50 loc) · 5.17 KB
/
gradlew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.ut.smartcook.frag;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.RadioGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.ut.smartcook.R;
import com.ut.smartcook.view.CategoryAdapter;
import com.ut.smartcook.view.RecipeCardAdapter;
import com.ut.smartcook.view.RecipeTxtAdapter;
import com.ut.smartcook.view.TaskAdapter;
import com.ut.smartcook.view.entity.CategoryInfo;
import com.ut.smartcook.view.entity.RecipeInfo;
import com.ut.smartcook.view.entity.TaskInfo;
import java.util.ArrayList;
import java.util.List;
public class RecipeCategoryHeadFrag extends Fragment {
List<CategoryInfo> categoryInfos;
RecyclerView recipeListRV;
String[] categoryInfosTest = new String[]{"辣不怕","招牌菜","田园时蔬","无肉不欢","快手菜","爆炒菜","酸酸辣辣","湘菜","粤菜","推荐","新菜系","台湾菜"};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.recipe_category_head,null);
RecyclerView recycler = view.findViewById(R.id.category_list_rv);
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
recycler.setLayoutManager(layoutManager);
initCategoryInfos();
CategoryAdapter categoryAdapter = new CategoryAdapter(categoryInfos);
recycler.setAdapter(categoryAdapter);
categoryAdapter.notifyDataSetChanged();
return view;
}
private void initCategoryInfos(){
categoryInfos = new ArrayList<>();
for (int i = 0;i < categoryInfosTest.length; i++){
CategoryInfo info =new CategoryInfo(categoryInfosTest[i]);
categoryInfos.add(info);
}
}
}