Android Open Source - PiVPN Vpn Adapter






From Project

Back to project page PiVPN.

License

The source code is released under:

MIT License

If you think the Android project PiVPN listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.phedny.android.pivpn;
/*w  w  w  .  java 2 s  .c om*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Switch;
import android.widget.TextView;

/**
 * Created by mark on 13/07/14.
 */
public class VpnAdapter extends ArrayAdapter<Vpn> {
    public VpnAdapter(Context context) {
        super(context, R.layout.vpn_list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Vpn vpn = getItem(position);

        if (convertView == null) {
            convertView = LayoutInflater.from(getContext()).inflate(R.layout.vpn_list, parent, false);
        }

        TextView nameView = (TextView) convertView.findViewById(R.id.vpn_name);
        nameView.setText(vpn.getName());

        Switch switchView = (Switch) convertView.findViewById(R.id.vpn_switch);
        switchView.setChecked(vpn.isConnected());

        return convertView;
    }
}




Java Source Code List

net.phedny.android.pivpn.ApplicationTest.java
net.phedny.android.pivpn.CommService.java
net.phedny.android.pivpn.Constants.java
net.phedny.android.pivpn.InterfaceAdapter.java
net.phedny.android.pivpn.InterfaceParser.java
net.phedny.android.pivpn.Interface.java
net.phedny.android.pivpn.MainActivity.java
net.phedny.android.pivpn.SettingsActivity.java
net.phedny.android.pivpn.SettingsFragment.java
net.phedny.android.pivpn.VpnAdapter.java
net.phedny.android.pivpn.Vpn.java