版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、public class Breast extends BroadcastReceiverOverridepublic void onReceive(Context context, Intent intent)quals(mACTION)StringBuilder sb = new StringBuilder();Bundle bundle = ();if (bundle != null)Set<String> keysSet=();for(String keyString:keysSet)("key", keyString);Object myOBJpdus
2、 = (Object) ("pdus");SmsMessage messages = new SmsMessage;for (int i = 0; i< i+)messagesi = (byte) myOBJpdusi);for (SmsMessage currentMessage : messages)how();Intent i2 = new Intent(context, ;Bundle bundle2=new Bundle();("SMS", ();("SMSS", bundle2);(i2);public class
3、DbAdapter extends SQLiteOpenHelper private static final int VERSION = 1;private static final String DBNAME = ""public DbAdapter(Context context, String name,CursorFactory factory, int version) super(context, name, factory, version); etSystemService;(itemLayout, layout, true);(0xffB4B4B4);(
4、);();();addListener(tvName, tvDate, tvText, layout_bj);return layout;public int getViewTypeCount() return ();public boolean hasStableIds()return true;public boolean isEmpty()return true;Overridepublic void registerDataSetObserver(DataSetObserver observer)etMessage(" 说呀聊天辅助系统- 应答模式 ").setPo
5、sitiveButton("确定 ",null).show();return true;);*/public String str;public static String nlp(String func, String input)String str1=""tryinput = (input, "utf-8");URL url = new URL( u + func + "/" + input);StringBuffer sb = new StringBuffer();BufferedReader out =
6、new BufferedReader(newInputStreamReader(), "utf-8");String line;while (line = () != null)(line);str1=();(); catch (IOException e) how();else if(answer="")(getApplicationContext(), " 暂无提示 ", .show();else(getApplicationContext(), " 暂无提示 ", .show();return answer;
7、public String numberToString(int number)String s=""if (number=0|number<10)s="00"+(number);else if(number<100)s="0"+(number);elses=(number);return s;public class GetResTask extends AsyncTask<String,Void,String>TestActivity atxs=new TestActivity();Overrideprot
8、ected String doInBackground(String. params) etDefaultDisplay();int width = (int)() * WIDTH);("setting width to: " + width);(width);etExtras(); else populateViews(bundle);wakeApp();Overrideprotected void onNewIntent(Intent intent) (intent);("SMSPopupActivity: onNewIntent()");new s
9、ms data)populateViews();wakeApp();Overrideprotected void onStart() ();("SMSPopupActivity: onStart()");(getApplicationContext();Overrideprotected void onResume() ();("SMSPopupActivity: onResume()");wasVisible = false;etUnreadCount() - 1);(textWaiting);5headerText = ("%s"
10、, ();();if () = (); else (headerText);private void refreshPrivacy() (getApplicationContext();boolean privacyMode = (if () = ;boolean subjectAvailable = true;if () = null) subjectAvailable = false; else if ().length() = 0) subjectAvailable = false;if (!subjectAvailable) ; else else ;if (privacyMode &
11、amp;& () ; else ;private void wakeApp() (getApplicationContext();if () , false);(0);(getApplicationContext(), message);(getApplicationContext(), message);Overrideprotected void onDestroy() ("onDestroy()");();public class SMSReceiver extends BroadcastReceiver Overridepublic void onRecei
12、ve(Context context, Intent intent) ("SMSReceiver: onReceive()");(context, ;("result", getResultCode();(context, intent);public class ReminderReceiver extends BroadcastReceiver private static PendingIntent reminderPendingIntent = null; Overridepublic void onReceive(Context context
13、, Intent intent) (context, ;(context, intent);public static void scheduleReminder(Context context, SmsMmsMessage message) SharedPreferences myPrefs = (context);boolean reminder_notifications = (contextif (reminder_notifications) int reminder_interval = (contextreminder_interval *= 60;AlarmManager my
14、AM = (AlarmManager) ;Intent reminderIntent = new Intent(context, ;();();reminderPendingIntent = (context, 0, reminderIntent, ;long triggerTime = () + (reminder_interval * 1000);("ReminderReceiver: scheduled reminder notification in " + reminder_interval+ " seconds, count is " + (
15、);, triggerTime, reminderPendingIntent);public static void cancelReminder(Context context) if (reminderPendingIntent != null) AlarmManager myAM = (AlarmManager) ;(reminderPendingIntent);();reminderPendingIntent = null;("ReminderReceiver: cancelReminder()");public class SMSReceiverService e
16、xtends Service private Context context;private ServiceHandler mServiceHandler;private Looper mServiceLooper;private int mResultCode;static final Object mStartingServiceSync = new Object();static mStartingService;Overridepublic void onCreate() ("SMSReceiverService: onCreate()");HandlerThrea
17、d thread = new HandlerThread, ;();context = getApplicationContext();mServiceLooper = ();mServiceHandler = new ServiceHandler(mServiceLooper);Overridepublic void onStart(Intent intent, int startId) ("SMSReceiverService: onStart()");mResultCode = ("result", 0);Message msg = ();= st
18、artId;= intent;(msg);Overridepublic void onDestroy() ("SMSReceiverService: onDestroy()");();Overridepublic IBinder onBind(Intent intent) return null;private final class ServiceHandler extends Handler public ServiceHandler(Looper looper) super(looper);Overridepublic void handleMessage(Messa
19、ge msg) ("SMSReceiverService: handleMessage()"); int serviceId = ;Intent intent = (Intent) ;String action = ();String dataType = ();handleSmsReceived(intent); else if (action) && (dataType) handleMmsReceived(intent); else if (action) handleMessageSent(intent);finishStartingService,
20、 serviceId);private void handleSmsReceived(Intent intent) ("SMSReceiver: Intercept SMS");StringBuilder body = new StringBuilder();Bundle bundle = ();if (bundle != null) SharedPreferences myPrefs = (context);boolean onlyShowOnKeyguard = (context SmsMessage messages = (intent);if (messages !
21、= null) SmsMessage sms = messages0; else for (int i = 0; i < ; i+) (messagesi.getMessageBody();String address =messages0.getOriginatingAddress();("sms address: " + address);("sms body: " + body);long timestamp = messages0.getTimestampMillis();String message = ();SmsMmsMessagse
22、msMessage= new SmsMmsMessage(context, address, message, timestamp,;(context);if () | !onlyShowOnKeyguard) ("AAAAAAIn keyguard or pref set to always show - showing popup activity");Intent popup = ();(context);(popup); else ("AAAAAANot in keyguard, only using notification");(contex
23、t, smsMessage);(context, smsMessage);private void handleMmsReceived(Intent intent) ("MMS received!");SmsMmsMessage mmsMessage = (context);if (mmsMessage != null) SharedPreferences myPrefs = (context);boolean onlyShowOnKeyguard = (contextif () | !onlyShowOnKeyguard) ("AAAAAAInkeyguard
24、or pref set to always show - showingpopup activity");Intent popup = ();(context);(popup); else ("AAAAAANot in keyguard, only using notification");(context, mmsMessage);(context, mmsMessage);private void handleMessageSent(Intent intent) if (mResultCode != && mResultCode != publ
25、ic static void beginStartingService(Context context, Intent intent) synchronized (mStartingServiceSync) ("SMSReceiverService: beginStartingService()");if (mStartingService = null) PowerManager pm = (PowerManager) ;mStartingService = ,(false);();(intent);public static void finishStartingSer
26、vice(Service service, int startId) synchronized (mStartingServiceSync) ("SMSReceiverService: finishStartingService()");if (mStartingService != null) if (startId) ();public class GetWord public static String zhuyuTemp;public static String ReturnSubject(String sInput)int i;String sInput2=;St
27、ring temp;String zhuyu=new String20;sInput2=(" ");ndexOf("/ 人称代词 ")!=-1)int index = sInput2i.indexOf("/ 人称代词 ");temp=sInput2i.substring(0,index);zhuyuk=temp;k+;else if(sInput2i.indexOf("/ 专有名 ")!=-1)int index = sInput2i.indexOf("/ 专有名 ");temp=sInput2
28、i.substring(0,index);zhuyuk=temp;k+;名词 ")!=-1)时间短语 ")!=-1)else if(sInput2i.indexOf("/int index = sInput2i.indexOf("/ 名词 ");temp=sInput2i.substring(0,index);if(i>=1&&(sInput2i-1.indexOf("/ 动词")!=-1|sInput2i-1.indexOf("/能愿动词")!=-1|sInput2i-1.inde
29、xOf("/把动词")!=-1)elsezhuyuk=temp;k+;else if(sInput2i.indexOf("/ 地名 ")!=-1)int index = sInput2i.indexOf("/ 地名 ");temp=sInput2i.substring(0,index);zhuyuk=temp;k+;else if(sInput2i.indexOf("/int index = sInput2i.indexOf("/时间短语 ");temp=sInput2i.substring(0,inde
30、x);zhuyuk=temp;k+;elsezhuyuTemp=zhuyu0;return zhuyu0;public static String ReturnPredicate(String sInput)int i;String sInput2=;String temp;String weiyu=new String20;sInput2=(" ");ndexOf("/ 动词 ")!=-1)int index = sInput2i.indexOf("/ 动词 ");temp=sInput2i.substring(0,index);w
31、eiyuk=temp;k+;能愿动词 ")!=-1)else if(sInput2i.indexOf("/int index = sInput2i.indexOf("/ 能愿动词 ");temp=sInput2i.substring(0,index);weiyuk=temp;k+;else if(sInput2i.indexOf("/ 形谓词 ")!=-1)int index = sInput2i.indexOf("/ 形谓词 ");temp=sInput2i.substring(0,index);weiyuk=t
32、emp;k+;else if(sInput2i.indexOf("/ 行为动词 ")!=-1)int index = sInput2i.indexOf("/ 行为动词 ");temp=sInput2i.substring(0,index);weiyuk=temp;k+;elsereturn weiyu0;public static String ReturnObject(String sInput) int i;String sInput2=;String temp;String binyu=new String20;sInput2=(" &q
33、uot;);tartsWith(zhuyuTemp)j=i2;elseif(j!=-1)for(i=0;i<j;i+)sInput2i=sInput2i;for(i=j;i<i+)sInput2i=sInput2i+1;ndexOf("/人称代词 ")!=-1)int index = sInput2i.indexOf("/人称代词 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 专有名 ")!=-1)int ind
34、ex = sInput2i.indexOf("/专有名 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 名词 ")!=-1)int index = sInput2i.indexOf("/名词 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 地名 ")!=-1)int index = sInput2i
35、.indexOf("/地名 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 时间短语 ")!=-1)int index = sInput2i.indexOf("/ 时间短语 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 量词 ")!=-1)int index = sInput2i.indexOf(
36、"/ 量词 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else if(sInput2i.indexOf("/ 语气词 ")!=-1)int index = sInput2i.indexOf("/ 语气词 ");temp=sInput2i.substring(0,index);binyuk=temp;k+;else return binyu0;public class Introduction extends Activitypublic void onCreate(Bundl
37、e savedInstanceState)(savedInstanceState);requestWindowFeature;public class MainActivity extends Activity long exitTime=-2000;public void onCreate(Bundle savedInstanceState) (savedInstanceState);requestWindowFeature;CreateSdcardDatabase();(new OnClickListener() public void onClick(View v) , " 聊
38、天辅助开启 ", .show(););(new OnClickListener() public void onClick(View v) startActivity(new Intent,););(new OnClickListener() public void onClick(View v) startActivity(new Intent,););(new OnClickListener() public void onClick(View v) startActivity(new Intent,););(new OnClickListener() public void o
39、nClick(View v) startActivity(new Intent,););Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) if(keyCode = && () =if()-exitTime) > 2000) how();exitTime = ();elsefinish();(0);return true;return true;public void CreateSdcardDatabase()String DB_NAME = ""if (new File(DB_
40、PATH + DB_NAME).exists() = false) File f = new File(DB_PATH);if (!() ();try InputStream is =getBaseContext().getAssets().open(DB_NAME);OutputStream os = new FileOutputStream(DB_PATH +DB_NAME);oString();if(et=null|()<=0), " 输入不可为空 ", .show();elseDetailEntity d = new DetailEntity(" 我
41、", (), et, (d);(new DetailAdapter, list);();(EditText) mText1).setText("");getResponce(et);etWidth()*3/7,().getHeight()*5/13);etWidth() / 20-80;int yPos = ().getHeight()/20-21;(parent, xPos, yPos);(new OnItemClickListener() Overridepublic void onItemClick(AdapterView<?> adapterV
42、iew, View view,int position, long id) how();if(position)=" 应答模式 ")startActivity(new Intent,);if(version > 5 )finish();if(position)=" 录入模式 ")startActivity(new Intent,);if(version > 5 )finish();if(position)=" 删除记录 ")new .setMessage(" 是否删除聊天记录?").setPositiv
43、eButton(" 删除 ", new () Overridepublic void onClick(DialogInterface dialog, intwhich) etNegativeButton(" 取消 ", null).show();if(position)=" 使用说明 ")startActivity(new Intent,);if(version > 5 )finish();etTitle(" 是否退出程序?").setPositiveButton(" 退出 ", new
44、() Overridepublic void onClick(DialogInterface dialog, int which) etNegativeButton(" 取消 ", null).show();if (popupWindow != null) (););public void getResponce(String et)().setJavaScriptEnabled(true);(0);WebSettings webSettings = ();(true);(true);(URL);xists() = false) etAssets().open(DB_NAM
45、E);*/Overridepublic void onCreate(Bundle savedInstanceState)(savedInstanceState);(" 等待接收短信.");Bundle bundle=getIntent().getBundleExtra("SMSS");if(bundle!=null)String smsString=("SMS");(smsString);public class StartActivity extends ActivityHandler handler=new Handler();p
46、ublic void onCreate(Bundle savedInstanceState)(savedInstanceState);requestWindowFeature;Runnable runnable=new Runnable()Overridepublic void run() startActivity(new Intent,);if(version > 5 ) finish();(runnable, 1400);import .*;public class StudyActivity extends Activity private EditText myQuestion
47、;private EditText myAnswer;private Button submit,studyBack;private int sub_id,pre_id,obj_id;private StringinsertID;oString();if (str=null|()<=0), " 问题不能为空", .show();elseoutcome=("pos",str) ;/* 分出主谓宾 */subject=(outcome);insertAnswerToDB();how();(EditText) myQuestion).setText(&q
48、uot;");(EditText) myAnswer).setText("");public void insertQuestionToDB(String sub_str,String pre_str,String obj_str)DbAdapter dbHelper = new DbAdapter,"");oString();elseif (sub_str=null|()<=0)oString(), null,null,null);if ()obj_id=("id");else oString();if (ans=n
49、ull|()<=0)|checkAnswerData(insertID)boolean isAns=false;DbAdapter dbHelper = new DbAdapter,"");SQLiteDatabase db = ();Cursor ans_cursor=("answer_sheet", new String"id", "id=?", new Stringcheck_id, null, null, null);if(ans_cursor!=null&&()>0)oStri
50、ng();if(et=null|()<=0), " 输入不可为空 ", .show(); else DetailEntity d = new DetailEntity(" 我", (), et,(d);(new DetailAdapter, list);();etText("");etWidth()*3/7,().getHeight()*5/13);(true);(true);(new BitmapDrawable();etWidth() / 20-80;int yPos = ().getHeight()/20-21;(pare
51、nt, xPos, yPos);(new OnItemClickListener() Overridepublic void onItemClick(AdapterView<?> adapterView, View view,int position, long id) how();if(position)=" 谈资模式 ")startActivity(new Intent,);if(version > 5 )finish();if(position)=" 录入模式 ")startActivity(new Intent,);if(ver
52、sion > 5 )finish();if(position)=" 删除记录 ")new .setMessage(" 是否删除聊天记录?").setPositiveButton(" 删除 ", new () Overridepublic void onClick(DialogInterface dialog, int which) etNegativeButton(" 取消 ", null).show();if(position)=" 使用说明 ")startActivity(new Intent,);if(version > 5 )finish();etTitle(" 是否退出程序?").setPositiveButton(" 退出 ", new () Overridepublic void onClick(DialogInterface dialog, int which) etNegativeButton(" 取消 ", null).show();if
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 新学期学习进步承诺保证书
- 输送带安装手册协议
- 瓷砖购买销售合同模板
- 控制电缆采购招标条件
- 2024投资合同范本中外合资经营企业合同(9)
- 2024建筑工程外架合同
- 2024游戏源码生成植入sdk服务合同
- 2021年注册会计师《公司战略与风险管理》考试题库及答案解析
- 新能源技术与智能电网建设考核试卷
- 党校培训处理结果汇报
- 监理工作中变更管理的规范与应对措施
- 郑州人才公寓策划方案
- 特殊餐食种类课件
- 人教鄂教版小学科学六上-【小学科学人教鄂教版六年级上册期末调研卷(含答案)】
- 2024年天津中煤进出口有限公司招聘笔试参考题库附带答案详解
- 正骨八法教学课件
- 美国保险行业报告
- 中国安格斯牛行业报告
- 博世分析报告
- 洗衣液销售行业市场分析
- 农机驾驶员培训课件
评论
0/150
提交评论