Search in sources :

Example 1 with AddNodesListAdapter

use of run.wallet.iota.ui.adapter.AddNodesListAdapter in project run-wallet-android by runplay.

the class NetworkNodesAddFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    listNodes.setLayoutManager(new RecyclerLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
    ((AppCompatActivity) getActivity()).setSupportActionBar(addNodeToolbar);
    setHasOptionsMenu(false);
    enterPod.setBackgroundColor(B.getColor(getActivity(), AppTheme.getSecondary()));
    addNodeToolbar.setNavigationIcon(getResources().getDrawable(R.drawable.md_nav_back));
    addNodeToolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getActivity().onBackPressed();
        }
    });
    protocol.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            changeProtocol();
        }
    });
    addNodeBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Nodes.Node node = new Nodes.Node();
            node.ip = nodeAddress.getText().toString();
            node.port = Sf.toInt(port.getText().toString());
            node.protocol = protocol.getText().toString();
            node.ip = Utils.stripHttp(node.ip);
            if (node.ip.length() > 3 && node.ip.contains(".") && node.port > 0) {
                Store.addNode(getActivity(), node.ip, node.port, node.protocol);
                getActivity().onBackPressed();
            } else {
                addressLayout.setError(getString(R.string.messages_enter_neighbor_address));
            }
        }
    });
    nodeAddress.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            // nodeAddress.
            addressLayout.setError(null);
        }
    });
    adapter = new AddNodesListAdapter(getActivity(), this);
    listNodes.setAdapter(adapter);
}
Also used : AddNodesListAdapter(run.wallet.iota.ui.adapter.AddNodesListAdapter) AppCompatActivity(android.support.v7.app.AppCompatActivity) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ListView(android.widget.ListView) Nodes(run.wallet.iota.model.Nodes) RecyclerLayoutManager(run.wallet.iota.ui.RecyclerLayoutManager) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable)

Aggregations

AppCompatActivity (android.support.v7.app.AppCompatActivity)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 View (android.view.View)1 ListView (android.widget.ListView)1 TextView (android.widget.TextView)1 BindView (butterknife.BindView)1 Nodes (run.wallet.iota.model.Nodes)1 RecyclerLayoutManager (run.wallet.iota.ui.RecyclerLayoutManager)1 AddNodesListAdapter (run.wallet.iota.ui.adapter.AddNodesListAdapter)1