This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Source: | |
| # https://www.cloudflare.com/ips | |
| # https://support.cloudflare.com/hc/en-us/articles/200169166-How-do-I-whitelist-CloudFlare-s-IP-addresses-in-iptables- | |
| # create new chains | |
| iptables -N CF 2>/dev/null | |
| ip6tables -N CF 2>/dev/null | |
| # clear chains | |
| iptables -F CF | |
| ip6tables -F CF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| speech = SpeechRecognizer.createSpeechRecognizer(this); | |
| speech.setRecognitionListener(new RecognitationListener(this)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void onVoiceActivation(View view) { | |
| Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "pl_PL"); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, view.getContext().getPackageName()); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); | |
| recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 3); | |
| this.speech.startListening(recognizerIntent); | |
| final Handler handler = new Handler(); | |
| handler.postDelayed(new Runnable() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| view.findViewById(R.id.voice_activation_button).setOnClickListener(new View.OnClickListener() { | |
| @Override | |
| public void onClick(View view) { | |
| onVoiceActivation(view); | |
| } | |
| }); |