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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//package cn.flightfeather.thirdapp.dataanalysis;
//
//
//import android.content.Context;
//import android.os.Bundle;
//import android.support.annotation.NonNull;
//import android.support.annotation.Nullable;
//import android.support.design.widget.NavigationView;
//import android.support.v4.app.Fragment;
//import android.support.v4.app.FragmentManager;
//import android.support.v4.widget.DrawerLayout;
//import android.view.Gravity;
//import android.view.LayoutInflater;
//import android.view.MenuItem;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.ImageView;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import cn.flightfeather.thirdapp.CommonApplication;
//import cn.flightfeather.thirdapp.R;
//import cn.flightfeather.thirdapp.httpservice.TaskService;
//
///**
// * 数据分析模块
// */
//public class AnysisFragment_B extends Fragment implements View.OnClickListener {
//
//    private CommonApplication application;
//    private TaskService taskService;
//    private Context context;
//    private Boolean visible = true;
//
//    private DrawerLayout drawerLayout;
//    private NavigationView NV_analysis;
//
//    private List<Fragment> fragmentList = new ArrayList<>();
//    private FragmentManager fragmentManager;
//    private Fragment fragmentCurrent;
//
//    private ImageView IV_menu;
//
//
//    @Override
//    public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                             Bundle savedInstanceState) {
//
//        return inflater.inflate(R.layout.fragment_anysis, container, false);
//    }
//
//    @Override
//    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//        super.onViewCreated(view, savedInstanceState);
//
//        application = (CommonApplication) getActivity().getApplication();
//        taskService = application.getRetrofit().create(TaskService.class);
//        context = getContext();
//        fragmentManager = getActivity().getSupportFragmentManager();
//
//        initActionbar(view);
//        initNavigationView(view);
//        initFragment();
//    }
//
//    private void initNavigationView(View view){
//        drawerLayout = (DrawerLayout) view.findViewById(R.id.DL_analysis);
//        NV_analysis = (NavigationView) view.findViewById(R.id.NV_analysis);
//
////        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, R.string.action_settings, R.string.action_settings);
////        drawerLayout.setDrawerListener(toggle);
////        toggle.syncState();
//
////        NV_analysis.setItemIconTintList(null);//设置图标颜色为本身颜色
//
//        NV_analysis.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
//            @Override
//            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
//                int order = item.getOrder();
//                try {
//                    switchSelectedFragment(fragmentList.get(order));
//                    IV_menu.refreshDrawableState();
//                }catch (Exception e){
//                    e.printStackTrace();
//                }
//                drawerLayout.closeDrawer(Gravity.END);
//                return true;
//            }
//        });
//    }
//
//    private void initFragment(){
//        fragmentList.add(new AnysisProgressFragment());
//        fragmentList.add(new AnysisProblemFragment());
////        fragmentList.add(new AnysisRankFragment());
//        fragmentManager.beginTransaction().add(R.id.FL_analysis, fragmentList.get(0)).commit();
//        fragmentCurrent = fragmentList.get(0);
//    }
//
//    private void switchSelectedFragment(Fragment fragment){
//        if (fragment.isAdded()){
//            fragmentManager.beginTransaction().hide(fragmentCurrent).show(fragment).commit();
//        }else {
//            fragmentManager.beginTransaction().add(R.id.FL_analysis, fragment).hide(fragmentCurrent).show(fragment).commit();
//        }
//
//        fragmentCurrent = fragment;
//    }
//
//    private void initActionbar(View view) {
////        view.findViewById(R.id.img_left).setVisibility(View.GONE);
////        view.findViewById(R.id.spinner_topclass_task).setVisibility(View.GONE);
////        view.findViewById(R.id.img_right).setOnClickListener(this);
////        ((TextView) view.findViewById(R.id.actionbar_title)).setTitle("数据分析");
//        IV_menu = (ImageView) view.findViewById(R.id.IV_menu);
//        IV_menu.setOnClickListener(this);
//    }
//
//
//    @Override
//    public void onHiddenChanged(boolean hidden) {
//        super.onHiddenChanged(hidden);
////        taskProgressAdapter.notifyDataSetChanged();
//    }
//
//    @Override
//    public void onClick(View v) {
//        switch (v.getId()) {
//            case R.id.IV_menu:
//                if (visible)drawerLayout.openDrawer(Gravity.END);
//                else drawerLayout.closeDrawer(Gravity.END);
//                visible = !visible;
//                break;
//
//        }
//    }
//}