summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java
blob: 5b3e57285b14a7cfb7256368281e5a65075f9645 (plain)
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
package se.leap.bitmaskclient;

import android.content.*;
import android.view.*;
import android.widget.*;

import com.pedrogomez.renderers.*;

import butterknife.*;

/**
 * Created by parmegv on 4/12/14.
 */
public class ProviderRenderer extends Renderer<Provider> {
    private final Context context;

    @InjectView(R.id.provider_name)
    TextView name;
    @InjectView(R.id.provider_domain)
    TextView domain;

    public ProviderRenderer(Context context) {
        this.context = context;
    }

    @Override
    protected View inflate(LayoutInflater inflater, ViewGroup parent) {
        View view = inflater.inflate(R.layout.provider_list_item, parent, false);
        ButterKnife.inject(this, view);
        return view;
    }

    @Override
    protected void setUpView(View rootView) {
        /*
         * Empty implementation substituted with the usage of ButterKnife library by Jake Wharton.
         */
    }

    @Override
    protected void hookListeners(View rootView) {
        //Empty
    }

    @Override
    public void render() {
        Provider provider = getContent();
        if (!provider.isDefault()) {
            name.setText(provider.getName());
            domain.setText(provider.getDomain());
        } else {
            domain.setText(R.string.add_provider);
        }
    }
}