ShinePans代码总结

com.android.speechrecorder; 导入 android.app.Activity; 导入 android.os.Bundle; 导入 android.os.Handler; 导入 android.speech.srec.Recognizer; 导入 android.speech.srec.WaveHeader; 导入 android.speech。srec.MicrophoneInputStream; 导入 android.util.Log; 导入 android.view.View; 导入 android.view.View.OnClickListener; 导入 android.widget.Button; 导入 android.widget.RadioButton; 导入 android.widget.TextView; 导入 java.io.BufferedWriter; 导入 java.io.ByteArrayOutputStream; 导入 java.io.File; 导入 java.io.FileFilter; 导入 java.io.FileOutputStream; 导入 java.io.FileWriter; 导入 java.io.IOException; 导入 java.io.InputStream; 导入 java.io.OutputStream; 公共类 SpeechRecorderActivity 扩展 Activity { private static final String TAG = "SpeechRecorderActivity"; 私有静态最终 int DURATION_SEC = 7; 私人处理程序 mHandler; 私有 TextView mCommand私有 TextView mStatus;私人按钮 mRecord私有按钮 mRedo;私人单选按钮 m8KHz;私人单选按钮 m11KHz私人 RadioButton mCall私人单选按钮 mDialNanp; 私人 RadioButton mDialPairs; 私有 InputStream mMicrophone;私有 ByteArrayOutputStream mBaos; 私人文件话语;私人 int mSampleRate; 私有线程 mThread;私人布尔 mStoppedListening; @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mHandler = new Handler(); setContentView(R.layout.recorder); mCommand = (TextView) findViewById(R.id.commandText); mStatus = (TextView) findViewById(R.id.statusText); mRecord = (Button) findViewById(R.id.recordButton); mRedo = (Button) findViewById(R.id.redoButton); m8KHz = (RadioButton)findViewById(R.id.codec8KHzRadioButton); m11KHz = (RadioButton)findViewById(R.id.codec11KHzRadioButton); mCall = (RadioButton)findViewById(R.id.callRadioButton); mDialNanp = (RadioButton)findViewById(R.id.dialNanpRadioButton); mDialPairs = (RadioButton)findViewById(R.id.dialPairsRadioButton); mCommand.setText("请点击'录制'开始"); mRecord.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (false) { Log.d(TAG, "mRecord.OnClickListener.onClick"); } setupRecording(); } }); mRedo.setEnabled(false); mRedo.setOnClickListener(new OnClickListener() { public void onClick(View v) { if (false) { Log.d(TAG, "mRedo. isChecked() ? mDialNanpUtterances : mDialPairs.isChecked() ? mDialPairsUtterances:空;言语 = 空;整数索引 = ⑴; for (int i = 0; i < utterances.length; i++) { File u = new File(getDir("recordings", MODE_PRIVATE), utterances[i].toLowerCase().replace(' ', '_') + ".wav"); if (!u.exists()) { mUtterance = u; 指数 = i; 打破; } } // 检查是否完成 if (mUtterance == null) { mCommand.setText("Finished:Thank You!"); 返回;} Log.d(TAG, "要录制" + mUtterance.toString()); // 修复 UI mCommand.setText("Say: "" postDelayed(new Runnable() { public void run() { if (remain > 0) { mStatus.setText(status + " Recording... " + stay); } else { mStatus.setText(status); stopRecording(); } } }, i * 1000); } // 现在启动一个线程来存储音频。mStoppedListening = false; mThread = new Thread() { public void run() { Log.d(TAG, "run audio capture thread"); 字节缓冲区[] = 新字节[512]; 而 (!mStoppedListening) { 尝试 { int rtn = 0; rtn = mMicrophone.read(buffer, 0, 512); if (rtn > 0) mBaos.write(buffer, 0, rtn); } catch (IOException e) { } } } }; mThread.start(); // 避免按钮点击 try { Thread.sleep(100); } catch (InterruptedException ie) { } } private void stopRecording() { Log.d(TAG, "stopRecording"); mStoppedListening = true; 尝试 { mThread.join(); } catch (InterruptedException e) { } try { OutputStream out = new FileOutputStream(mUtterance.toString()); 尝试 { byte[] pcm = mBaos.toByteArray(); Log.d(TAG, "byteArray 长度" + pcm.length); WaveHeader hdr = new WaveHeader(WaveHeader. FORMAT_PCM, (short)1, mSampleRate, (short)16, pcm.length); hdr.write(out); 输出(PCM);} 最后{ out.close(); mMicrophone.close(); mBaos.close(); } } catch (IOException e) { } finally { } // 停止录制 mRecord.setEnabled(true); mRedo.setEnabled(true); mCommand.setText("明白了!"); } private final static String[] mCallUtterances = new String[] { "Call Adam Varro", "Call Alex Lloyd", "Call Amod Karve", "Call Ana Maria Lopez", "Call Ben Sigelman", "Call Chris Vennard" ,

-optimizationpasses 5 # 指定代码的紧缩级别 -dontusemixedcaseclassnames # 是不是使用大小写混合 -dontskipnonpubliclibraryclasses # 是不是混淆第3方jar -dontpreverify # 混淆时是不是做预校验 -verbose # 混淆时是不是记录日志 -optimizations !code/simplification/arithmetic,!field/*,!class/merging/* # 混淆时所采取的算法 -keep public class * extends android.app.Activity # 保持哪些类不被混淆 -keep public class * extends android.app.Application # 保持哪些类不被混淆 -keep public class * extends android.app.Service # 保持哪些类不被混淆 -keep public class * extends android.content.BroadcastReceiver # 保持哪些类不被混淆 -keep public class * extends android.content.ContentProvider # 保持哪些类不被混淆 -keep public class * extends android.app.backup.BackupAgentHelper # 保持哪些类不被混淆 -keep public class * extends android.preference.Preference # 保持哪些类不被混淆 -keep public class com.android.vending.licensing.ILicensingService # 保持哪些类不被混淆 -libraryjars libs/gson⑵.0.jar # 保持 第3方jar不被混淆 -keepclasseswithmembernames class * { # 保持 native 方法不被混淆 native <methods>; } -keepclasseswithmembers class * { # 保持自定义控件类不被混淆 public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembers class * { public <init>(android.content.Context, android.util.AttributeSet, int); # 保持自定义控件类不被混淆 } -keepclassmembers class * extends android.app.Activity { # 保持自定义控件类不被混淆 public void *(android.view.View); } -keepclassmembers enum * { # 保持枚举 enum 类不被混淆 public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { # 保持 Parcelable 不被混淆 public static final android.os.Parcelable$Creator *; } -keepclassmembers class **.R$* { # 保持R文件不被混淆 public static <fields>; } -keep class com.alipay.android.app.IAliPay{*;} # 保持某个接口或类不被混淆 -keep class com.android.app.view**{*;} # 保持某个包下所有的类不被混淆 -keep class com.android.app.CommonCallback{ # 保持某个类或接口的公有和保护类型的成员和方法不被混淆 public protected <fields>; public protected <methods>; } -keep class com.android.app.Platform$*{ # 保持内部类不被混淆 *; } #-keep class com.android.app.** implements com.android.app.Platform$ICallback {*;} # 保持内部接口不被混淆 -dontwarn android.support.**

<html> <meta http-equiv="content-type" content="text/html;charset=UTF⑻"/> <head> <body> <center> <!--空格  --> <!--img src="与html文件位置相同或本地url或网络url" width="xxpx为边框宽度" style="boder:1px为css布局 solide red 边框色彩"--> <table background="flowers.jpg" width="90%" border="0px" height="80px" cellspacing="0px"> <tr> <td><h1><font color="white">ShinePans的测试网站</font></h1><td> <td align="right"> <a href="myclass.html">查看我的课表</a> </td> </tr> </table> <!--tr标示1行--> <!--td代表1列--> <!--bgcolor背景色彩--> <!--Table 1测试--> <table background="flowers3.jpg" border="1px" width="90%" height="500px"> <!--页面占比--> <tr ><td><font color="white">第1行</font></td><td><font color="white">第2列</font></td><td>第3列</font></td><td>第4列</font></td></tr> <tr><td>第2行</font></td><td align="left">居左</font></td><td align="center">居中</font></td><td align="right">居右</font></td></tr> <tr><td>第3行</font></td><td>a11</font></td><td align="center">a12</font></td><td align="right">a13</td></tr> <tr><td>第4行</font></td><td>a21</font></td><td align="center">a22</font></td><td align="right">a23</font></td></tr> <tr><td>第5行</font></td><td>a31<</font>/td><td align="center">a32</font></td><td align="right">a33</font></td></tr> </table> <!--table 2 测试--> <table cellspacing="0px" bordercolor="#FFD2D2" bgcolor="#BBFFFF" border="2px" width="90%" height="300px"> <!--5行--> <!--solspan="3"横跨3行--> <tr> <td align="center" colspan="3">栏目</td> </tr> <tr> <td align="center">花</td> <td align="center">风景</td> <td align="center">人物</td> </tr> <tr> <td align="center" rowspan="3"><img src="flower4.jpg" width="300px"></td> <td align="center" rowspan="3"><img src="view.jpg" width="300px"></td> <td align="center" rowspan="3"><img src="girl.jpg" width="300px"></td> </tr> <tr> </tr> <tr> </tr> <table/> <br/> <br/> <br/>_________________________________________________________<br/> <br/><img src="flowers.jpg" width="400px" style="border: 0px solide red" alt="Flowers"/> <br/><a href="http://www.baidu.com">打开百度</a>   <a href="mailto:shinepans@live.com">shinepans@live.com <a/> </center> </body> </head> </html>

posted @ 2021-08-25 10:25  v17166570219  阅读(73)  评论(0)    收藏  举报