@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPrefs = getActivity().getSharedPreferences(Constants.SHARED_PREF, Context.MODE_PRIVATE); sLab = Lab.get(getActivity()); new getTrackingTask().execute(sLab.getCurrentUser()); new getTrackerTask().execute(sLab.getCurrentUser()); }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.setting, parent, false); mProgressBar = v.findViewById(R.id.settingProgressContainer); mProgressBar.setVisibility(View.INVISIBLE); mCode = (TextView) v.findViewById(R.id.add_tracking_code); String code = sLab.getUniqueCode(); mCode.setText(code); mFeedBackButton = (ImageButton) v.findViewById(R.id.feedBackButton); mFeedBackButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub boolean mConnected = Lab.hasConnection(getActivity()); if (!mConnected) { showToast(getString(R.string.connection_internet)); return; } else { Intent i = new Intent(getActivity(), FeedBackActivity.class); startActivity(i); } } }); mConnectEditText = (EditText) v.findViewById(R.id.add_tracking_connect); mConnectEditText.addTextChangedListener( new TextWatcher() { @Override public void afterTextChanged(Editable s) { mConnectText = s.toString(); } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} }); mConnectButton = (ImageButton) v.findViewById(R.id.add_tracking_connect_button); mConnectButton.setOnClickListener(new ConnectButtonListener()); mTrackers = (ListView) v.findViewById(R.id.add_tracking_trackers); mTracking = (ListView) v.findViewById(R.id.add_tracking_tracking); return v; }
@Override public void onClick(View v) { // TODO Auto-generated method stub boolean mConnected = Lab.hasConnection(getActivity()); if (mConnected && mConnectText != null && mConnectText.length() != 0) { new checkUserExistsTask().execute(); } else if (!mConnected) { showToast(getString(R.string.connection_internet)); } else { showToast("Fill out the form"); } }