DialpadView.java

 1/*
 2 * Copyright 2012-2015 the original author or authors.
 3 *
 4 * This program is free software: you can redistribute it and/or modify
 5 * it under the terms of the GNU General Public License as published by
 6 * the Free Software Foundation, either version 3 of the License, or
 7 * (at your option) any later version.
 8 *
 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18package eu.siacs.conversations.ui.widget;
19
20import android.content.Context;
21import android.util.AttributeSet;
22import android.view.View;
23
24import androidx.constraintlayout.widget.ConstraintLayout;
25import eu.siacs.conversations.R;
26import eu.siacs.conversations.xmpp.jingle.JingleRtpConnection;
27
28public class DialpadView extends ConstraintLayout implements View.OnClickListener {
29
30    public DialpadView(Context context) {
31        super(context);
32        init();
33    }
34
35    public DialpadView(Context context, AttributeSet attrs) {
36        super(context, attrs);
37        init();
38    }
39
40    public DialpadView(Context context, AttributeSet attrs, int defStyleAttr) {
41        super(context, attrs, defStyleAttr);
42        init();
43    }
44
45    private void init() {
46        inflate(getContext(), R.layout.dialpad, this);
47        initViews();
48    }
49
50    private void initViews() {
51        findViewById(R.id.dialpad_1_holder).setOnClickListener(this);
52        findViewById(R.id.dialpad_2_holder).setOnClickListener(this);
53        findViewById(R.id.dialpad_3_holder).setOnClickListener(this);
54        findViewById(R.id.dialpad_4_holder).setOnClickListener(this);
55        findViewById(R.id.dialpad_5_holder).setOnClickListener(this);
56        findViewById(R.id.dialpad_6_holder).setOnClickListener(this);
57        findViewById(R.id.dialpad_7_holder).setOnClickListener(this);
58        findViewById(R.id.dialpad_8_holder).setOnClickListener(this);
59        findViewById(R.id.dialpad_9_holder).setOnClickListener(this);
60        findViewById(R.id.dialpad_0_holder).setOnClickListener(this);
61        findViewById(R.id.dialpad_asterisk_holder).setOnClickListener(this);
62        findViewById(R.id.dialpad_pound_holder).setOnClickListener(this);
63    }
64
65    @Override
66    public void onClick(View v) {
67        /* TODO: this widget doesn't know anything about the RTP Connection,
68            so how to make this widget generic but also able to send touch-tone sounds
69         */
70        System.out.println("v.getTag() = " + v.getTag());
71    }
72
73}