hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
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
package com.rockchip.alexa.jacky.fragment;
 
 
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
 
import com.rockchip.alexa.jacky.R;
import com.rockchip.alexa.jacky.activity.AlexaActivity;
import com.rockchip.alexa.jacky.activity.DeviceUpdateActivity;
import com.rockchip.alexa.jacky.activity.HotspotActivity;
import com.rockchip.alexa.jacky.app.AuthManager;
import com.rockchip.alexa.jacky.app.BaseApplication;
import com.rockchip.alexa.jacky.listener.OnSingleClickListener;
import com.rockchip.alexa.jacky.views.LoadingView;
 
 
/**
 * Created by Administrator on 2017/3/21.
 */
 
public class SupportsFragment extends NoFragment {
 
    private Toolbar mToolbar;
    private TextView mBtnBack;
 
    private RelativeLayout mAlexa;
    private RelativeLayout mWifiSetup;
    private RelativeLayout mBluSetup;
    private RelativeLayout mDeviceUpdate;
 
    private LoadingView mLoadingView;
 
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.frag_supportlist, container, false);
    }
 
    private AlertDialog alert;
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
        mBtnBack = (TextView) view.findViewById(R.id.toolbar_back);
        mAlexa = (RelativeLayout) view.findViewById(R.id.list_support_alexa);
        mWifiSetup = (RelativeLayout) view.findViewById(R.id.list_support_wifi_setup);
        mBluSetup = (RelativeLayout) view.findViewById(R.id.list_support_blu_setup);
        mDeviceUpdate = (RelativeLayout) view.findViewById(R.id.list_support_update);
 
        mLoadingView = new LoadingView(getActivity(), getString(R.string.wifi_connecting));
 
        mAlexa.setOnClickListener(new OnSingleClickListener() {
            @Override
            protected void onSingleClick(View view) {
                BaseApplication.getApplication().setSetupWifi(false);
//                if (AuthManager.getAuthManager().isAuthorized()) {
//                    ((AlexaActivity) getActivity()).setAuthorized(true);
//                    startFragment(AlexaAuthorSuccessFragment.class, false);
//                } else {
//                    ((AlexaActivity) getActivity()).setAuthorized(false);
                    //startFragment(AlexaIndexFragment.class, false);
                    startFragment(HotspotFragment.class, false);
//                }
            }
        });
 
        mWifiSetup.setOnClickListener(new OnSingleClickListener() {
            @Override
            protected void onSingleClick(View view) {
                BaseApplication.getApplication().setSetupWifi(true);
                startActivity(new Intent(getActivity(), HotspotActivity.class));
            }
        });
 
        mBluSetup.setOnClickListener(new OnSingleClickListener() {
            @Override
            protected void onSingleClick(View view) {
                BaseApplication.getApplication().setSetupBlu(true);
                startActivity(new Intent(getActivity(), HotspotActivity.class));
            }
        });
 
        mDeviceUpdate.setOnClickListener(new OnSingleClickListener() {
            @Override
            protected void onSingleClick(View view) {
                startActivity(new Intent(getActivity(), DeviceUpdateActivity.class));
            }
        });
 
        mBtnBack.setOnClickListener(new OnSingleClickListener() {
            @Override
            protected void onSingleClick(View view) {
                getActivity().finish();
            }
        });
 
    }
 
    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ((AlexaActivity)getActivity()).setFragment(this);
        setToolbar(mToolbar);
 
        // Set title for toolbar:
//        setTitle("Partner App");
 
        // Display close button.
//        displayHomeAsUpEnabled(R.drawable.ic_toolbar_back);
    }
 
    @Override
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
//        inflater.inflate(R.menu.menu_fragment_main, menu);
    }
 
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return super.onOptionsItemSelected(item);
    }
}