Search in sources :

Example 1 with NetConnectionHelper

use of io.spark.core.android.util.NetConnectionHelper in project android-app by spark.

the class SmartConfigFragment method onAttach.

@Override
public void onAttach(Activity activity) {
    super.onAttach(activity);
    wifiHelper = new NetConnectionHelper(activity);
    receiver = new SmartConfigFoundSomethingReceiver();
    failHandler = new Handler();
    smartConfigFailedRunnable = new Runnable() {

        @Override
        public void run() {
            getActivity().startActivity(new Intent(getActivity(), NoCoresFoundActivity.class));
            getActivity().finish();
        }
    };
}
Also used : NetConnectionHelper(io.spark.core.android.util.NetConnectionHelper) Handler(android.os.Handler) Intent(android.content.Intent)

Example 2 with NetConnectionHelper

use of io.spark.core.android.util.NetConnectionHelper in project android-app by spark.

the class LoginActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_log_in);
    mEmailView = Ui.findView(this, R.id.email);
    mPasswordView = Ui.findView(this, R.id.password);
    mEmailView.setText(prefs.getUsername());
    netConnectionHelper = new NetConnectionHelper(this);
    mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
            if (id == R.id.login || id == EditorInfo.IME_NULL) {
                attemptLogin();
                return true;
            }
            return false;
        }
    });
    accountAction = Ui.findView(this, R.id.sign_up_button);
    accountAction.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            attemptLogin();
        }
    });
    // keyboard pops up
    for (View view : list(mEmailView, mPasswordView)) {
        view.setOnTouchListener(new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    scrollAccountForm();
                }
                return false;
            }
        });
    }
    TextView noAccountYet = Ui.setTextFromHtml(this, R.id.no_account_yet, R.string.i_dont_have_an_account);
    noAccountYet.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            launchSignUpActivity();
        }
    });
    TextView forgotPassword = Ui.setTextFromHtml(this, R.id.forgot_password, R.string.action_forgot_password);
    forgotPassword.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            openUri(R.string.uri_forgot_password);
        }
    });
}
Also used : NetConnectionHelper(io.spark.core.android.util.NetConnectionHelper) KeyEvent(android.view.KeyEvent) OnTouchListener(android.view.View.OnTouchListener) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) OnClickListener(android.view.View.OnClickListener) View(android.view.View) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) MotionEvent(android.view.MotionEvent)

Aggregations

NetConnectionHelper (io.spark.core.android.util.NetConnectionHelper)2 Intent (android.content.Intent)1 Handler (android.os.Handler)1 KeyEvent (android.view.KeyEvent)1 MotionEvent (android.view.MotionEvent)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 OnTouchListener (android.view.View.OnTouchListener)1 ScrollView (android.widget.ScrollView)1 TextView (android.widget.TextView)1