Example usage for android.view View.OnClickListener View.OnClickListener

List of usage examples for android.view View.OnClickListener View.OnClickListener

Introduction

In this page you can find the example usage for android.view View.OnClickListener View.OnClickListener.

Prototype

View.OnClickListener

Source Link

Usage

From source file:com.zapto.park.ParkActivity.java

public void onCreate(Bundle savedInstance) {
    super.onCreate(savedInstance);
    setContentView(R.layout.main);//from  w w  w .  j av  a 2  s . c o  m
    context = getApplicationContext();

    Button button_checkIn = (Button) findViewById(R.id.button_checkin);
    Button button_forma = (Button) findViewById(R.id.button_forma);

    button_checkIn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.i(LOG_TAG, "Check-in clicked.");
            Intent intent = new Intent(context, PadActivity.class);
            startActivityForResult(intent, ACTIVITY_RESULT_PAD);
        }
    });

    button_forma.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Log.i(LOG_TAG, "Check-in clicked.");
            Intent intent = new Intent(context, PadActivity.class);
            startActivityForResult(intent, ACTIVITY_RESULT_PAD);
        }
    });

    Log.i(LOG_TAG, "LICENSE KEY1: " + Globals.LICENSE_KEY);
    doInit();
}

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

public filter_dialog(Context cx, List<NameValuePair> data) {
    super(cx);//from   ww w .j  a va2 s.co  m
    this.cx = cx;
    this.webData = data;
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    vocl = new View.OnClickListener() {
        public void onClick(View v) {
            onCheckboxClick(v);
        }
    };

    maxLines = new OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView tv, int action, KeyEvent key) {
            boolean handled = false;
            if (action == EditorInfo.IME_ACTION_DONE) {
                setMaxLines(tv.getText().toString());
                tv.setText(getNamedData("iPage"));
                InputMethodManager imm = (InputMethodManager) tv.getContext()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(tv.getWindowToken(), 0);
                handled = true;
            }
            return handled;
        }
    };
    rateListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            rateSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
    licenseListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            licenseSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };
    placementListener = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            placementSelected((String) parent.getItemAtPosition(pos));
        }

        public void onNothingSelected(AdapterView<?> parent) {
        }
    };

}

From source file:provision.app.store.AppStore.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup root = (ViewGroup) inflater.inflate(R.layout.appstore, null);

    /** Button **/

    LinearLayout a = (LinearLayout) root.findViewById(R.id.button1);
    LinearLayout b = (LinearLayout) root.findViewById(R.id.button2);
    LinearLayout c = (LinearLayout) root.findViewById(R.id.button3);
    LinearLayout d = (LinearLayout) root.findViewById(R.id.button4);
    LinearLayout e = (LinearLayout) root.findViewById(R.id.button5);
    ImageButton la = (ImageButton) root.findViewById(R.id.icon1);
    ImageButton lb = (ImageButton) root.findViewById(R.id.icon2);
    ImageButton lc = (ImageButton) root.findViewById(R.id.icon3);
    ImageButton ld = (ImageButton) root.findViewById(R.id.icon4);
    ImageButton le = (ImageButton) root.findViewById(R.id.icon5);

    a.setOnClickListener(new View.OnClickListener() {

        @Override//  www .  java 2s . c o m
        public void onClick(View v) {

            Intent intent = new Intent();
            intent.setClass(getActivity(), AppInfo.class);
            intent.putExtra("app", "netfree");
            startActivity(intent);
        }
    });

    b.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent();
            intent.setClass(getActivity(), AppInfo.class);
            intent.putExtra("app", "netpro");
            startActivity(intent);
        }
    });

    c.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent();
            intent.setClass(getActivity(), AppInfo.class);
            intent.putExtra("app", "opfree");
            startActivity(intent);
        }
    });

    d.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent();
            intent.setClass(getActivity(), AppInfo.class);
            intent.putExtra("app", "oppro");
            startActivity(intent);
        }
    });

    e.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent();
            intent.setClass(getActivity(), AppInfo.class);
            intent.putExtra("app", "studio");
            startActivity(intent);
        }
    });

    la.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=provision.netspeed.optimizer"));//Provision 3g/4g netspeed optimizer free
            startActivity(intent);
        }
    });
    lb.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=provision.netspeed.optimizer.pro"));//Provision 3g/4g netspeed optimizer pro
            startActivity(intent);
        }
    });
    lc.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=provision.optimizer.patch.free"));//Provision optimizer free
            startActivity(intent);
        }
    });
    ld.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=provision.optimizer.patch"));//Provision optimizer pro
            startActivity(intent);
        }
    });
    le.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse("market://details?id=provision.root.studio"));//Provision Root Studio
            startActivity(intent);
        }
    });

    return root;
}

From source file:org.occupycincy.android.OccupyCincyActivity.java

/** Called when the activity is first created. */
@Override/*from   w ww . ja  va 2 s . c o m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    TextView link = (TextView) findViewById(R.id.lblOccupy);
    link.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_occupy))));
        }
    });

    Button btn = (Button) findViewById(R.id.btnGetInvolved);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_getInvolved))));
        }
    });

    btn = (Button) findViewById(R.id.btnDonate);
    btn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.url_donate))));
        }
    });

    getOccupyFeed(false);
}

From source file:org.geometerplus.fbreader.plugin.local_opds_scanner.ScanLocalNetworkActivity.java

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.scan_local_network);

    setListAdapter(new ItemAdapter());

    setTitle(R.string.scan_local_network_window_title);

    final View buttonView = findViewById(R.id.scan_local_network_buttons);

    final Button cancelButton = (Button) buttonView.findViewById(R.id.cancel_button);
    cancelButton.setText(R.string.button_cancel);
    cancelButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            finish();/*  www  .  j av  a2 s  .  c  o m*/
        }
    });

    final WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    final int state = wifiManager.getWifiState();
    if (state != WifiManager.WIFI_STATE_ENABLED && state != WifiManager.WIFI_STATE_ENABLING) {
        setTitle(R.string.wifi_is_turned_off);
        final View listView = findViewById(android.R.id.list);
        final TextView errorView = (TextView) findViewById(R.id.scan_local_network_error);
        listView.setVisibility(View.GONE);
        errorView.setVisibility(View.VISIBLE);
        errorView.setText(R.string.turn_wifi_on);

        final Button turnOnButton = (Button) buttonView.findViewById(R.id.ok_button);
        turnOnButton.setText(R.string.button_turn_on);
        turnOnButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                wifiManager.setWifiEnabled(true);
                finish();
            }
        });

        myLock = null;
    } else {
        final Button rescanButton = (Button) buttonView.findViewById(R.id.ok_button);
        rescanButton.setText(R.string.button_rescan);
        rescanButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                runOnUiThread(new Runnable() {
                    public void run() {
                        clear();
                        scan();
                    }
                });
            }
        });

        myLock = wifiManager.createMulticastLock("FBReader_lock");
        myLock.setReferenceCounted(true);
        myLock.acquire();

        scan();
    }
}

From source file:com.altcanvas.twitspeak.TwitSpeakActivity.java

public void continueOnCreate() {
    G.init(this);
    db = new Database(this);

    twitBox = (TextView) findViewById(R.id.twitbox);
    settingsIcon = (ImageView) findViewById(R.id.settings);
    twitBox.setText("Loading");

    twitBox.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            speakTwit();//w  w  w  .  java2 s . c o  m
        }
    });

    settingsIcon.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            Intent iSettings = new Intent();
            iSettings.setClassName("com.altcanvas.twitspeak", SettingsActivity.class.getName());
            TwitSpeakActivity.this.startActivity(iSettings);
        }
    });

    Intent checkIntent = new Intent();
    checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
    startActivityForResult(checkIntent, G.REQCODE_CHECK_TTS);
}

From source file:com.vuze.android.remote.fragment.TorrentTagsFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View topView = inflater.inflate(R.layout.frag_torrent_tags, container, false);

    tvTags = (TextView) topView.findViewById(R.id.openoptions_tags);

    Button btnNew = (Button) topView.findViewById(R.id.torrent_tags_new);
    if (btnNew != null) {
        btnNew.setOnClickListener(new View.OnClickListener() {
            @Override/*from  w w  w .j a  v a 2 s  .  c o  m*/
            public void onClick(View v) {
                AlertDialog.Builder builder = AndroidUtilsUI.createTextBoxDialog(getContext(),
                        R.string.create_new_tag, R.string.newtag_name,
                        new AndroidUtilsUI.OnTextBoxDialogClick() {

                            @Override
                            public void onClick(DialogInterface dialog, int which, EditText editText) {

                                final String newName = editText.getText().toString();
                                sessionInfo.executeRpc(new SessionInfo.RpcExecuter() {

                                    @Override
                                    public void executeRpc(TransmissionRPC rpc) {
                                        rpc.addTagToTorrents(TAG, new long[] { torrentID },
                                                new Object[] { newName });
                                    }
                                });
                            }
                        });
                builder.create().show();

            }
        });
    }

    return topView;
}

From source file:it.scoppelletti.mobilepower.app.ReleaseNoteActivity.java

/**
 * Creazione dell&rsquo;attivit&agrave;.
 * /*  w w  w.  j  a va 2  s. c o  m*/
 * @param savedInstanceState Stato dell&rsquo;istanza.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    String notes;
    TextView textControl;
    Button button;
    MarketTagHandler tagHandler;

    super.onCreate(savedInstanceState);

    setTheme(AppUtils.getActivityTheme());
    setContentView(R.layout.releasenotes);

    textControl = (TextView) findViewById(R.id.txt_content);
    textControl.setKeyListener(null);
    textControl.setAutoLinkMask(Linkify.EMAIL_ADDRESSES | Linkify.WEB_URLS);

    notes = getIntent().getStringExtra(ReleaseNoteActivity.EXTRA_RELEASENOTES);
    if (!StringUtils.isBlank(notes)) {
        tagHandler = new MarketTagHandler();
        textControl.setText(Html.fromHtml(notes, null, tagHandler));
        tagHandler.addLinks(textControl, AppUtils.getFullPackageName(this, false));
    }

    button = (Button) findViewById(R.id.cmd_continue);
    button.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });
}

From source file:uk.ac.hutton.ics.buntata.adapter.DeveloperAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    final Developer item = Developer.values(context)[position];

    holder.name.setText(item.name);/*from   ww  w.j  av  a2 s  .  c om*/
    holder.title.setText(item.title);
    holder.group.setText(item.group);
    holder.institute.setText(item.institute);

    holder.email.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ShareCompat.IntentBuilder.from(context).setType("message/rfc822").addEmailTo(item.email)
                    .setSubject(context.getString(R.string.contact_email_subject))
                    .setChooserTitle(R.string.contact_email_dialog_title).startChooser();
        }
    });

    holder.name.setVisibility(StringUtils.isEmpty(item.name) ? View.GONE : View.VISIBLE);
    holder.group.setVisibility(StringUtils.isEmpty(item.group) ? View.GONE : View.VISIBLE);
    holder.institute.setVisibility(StringUtils.isEmpty(item.institute) ? View.GONE : View.VISIBLE);
    holder.email.setVisibility(StringUtils.isEmpty(item.email) ? View.GONE : View.VISIBLE);
    holder.separatorBottom.setVisibility(StringUtils.isEmpty(item.email) ? View.GONE : View.VISIBLE);
}

From source file:io.oceanos.shaderbox.ShaderEditorActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final LayoutInflater inflater = getLayoutInflater();
    final View customActionBarView = inflater.inflate(R.layout.actionbar_view_save, null);
    final View shaderActionView = customActionBarView.findViewById(R.id.actionbar_view);
    final View shaderActionSave = customActionBarView.findViewById(R.id.actionbar_save);
    shaderActionView.setOnClickListener(new View.OnClickListener() {
        @Override//from   www. j  a  va  2  s  .c o m
        public void onClick(View v) {
            if (result.isSuccess())
                onView(shader);
            else {
                Toast errorMsg = Toast.makeText(getBaseContext(), result.getError(), Toast.LENGTH_LONG);
                errorMsg.getView().setBackgroundColor(getResources().getColor(R.color.editor_color_error));
                errorMsg.show();
            }
        }
    });
    shaderActionSave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onSave(shader);
        }
    });

    fps = (TextView) customActionBarView.findViewById(R.id.text_fps);
    viewError = (TextView) shaderActionView.findViewById(R.id.viewError);

    final ActionBar actionBar = getActionBar();
    actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
    actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    setContentView(R.layout.activity_editor);

    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    ShaderDatabase database = new ShaderDatabase(getBaseContext());
    if (Intent.ACTION_SEND.equals(action) && type != null) {
        if ("text/plain".equals(type)) {
            String sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
            long id = database.newShader();
            Cursor cursor = database.findById(id);
            if (cursor.moveToFirst())
                shader = Shader.getValues(cursor);
            cursor.close();
            if (sharedText != null)
                shader.setText(sharedText);
            else
                shader.setText("");
        }
    } else {
        long id = intent.getLongExtra("ID", 0);
        Cursor cursor = database.findById(id);
        if (cursor.moveToFirst())
            shader = Shader.getValues(cursor);
        cursor.close();
    }
    database.close();

    setSymbolListener(R.id.action_tab, '\t');
    setSymbolListener(R.id.action_rpo, '(');
    setSymbolListener(R.id.action_rpc, ')');
    setSymbolListener(R.id.action_cpo, '{');
    setSymbolListener(R.id.action_cpc, '}');
    setSymbolListener(R.id.action_dotcoma, ';');
    setSymbolListener(R.id.action_coma, ',');
    setSymbolListener(R.id.action_dot, '.');
    setSymbolListener(R.id.action_plus, '+');
    setSymbolListener(R.id.action_minus, '-');
    setSymbolListener(R.id.action_times, '*');
    setSymbolListener(R.id.action_div, '/');
    setSymbolListener(R.id.action_equal, '=');
    setSymbolListener(R.id.action_spo, '[');
    setSymbolListener(R.id.action_spc, ']');
    setSymbolListener(R.id.action_and, '&');
    setSymbolListener(R.id.action_or, '|');
    setSymbolListener(R.id.action_greater, '>');
    setSymbolListener(R.id.action_lesser, '<');
    setSymbolListener(R.id.action_cardinal, '#');

    final Handler uiHandler = new Handler(this);
    renderer = new ShaderRenderer(shader, uiHandler);

    shaderView = (ShaderGLView) findViewById(R.id.shader_view);
    shaderView.setRenderer(renderer);
    shaderView.setVRModeEnabled(false);

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    int textSize = Integer.parseInt(prefs.getString("pref_editor_text_size", "14"));
    int opacity = Integer.parseInt(prefs.getString("pref_editor_opacity", "127"));
    editor = (ShaderEditor) findViewById(R.id.editor);
    editor.setTextSize(textSize);
    editor.setBackgroundColor(opacity << 24);
    editor.setHorizontallyScrolling(true);
    editor.setHorizontalScrollBarEnabled(true);

    editor.setText(shader.getText());

    ScrollView scroll = (ScrollView) findViewById(R.id.scroll);
    editor.setScrollView(scroll);

    compileRT = prefs.getBoolean("pref_compile_rt", true);
}