package com.ideabobo.Javascript;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URISyntaxException;
import java.util.UUID;
import org.apache.cordova.CordovaActivity;
import org.json.JSONException;
import org.json.JSONObject;
import com.ideabobo.gap.MainActivity;
import com.ideabobo.gap.R;
import com.ideabobo.tool.FileTool;
import com.ideabobo.tool.SessionStorage;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Point;
import android.graphics.Rect;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnCompletionListener;
import android.media.MediaRecorder;
import android.net.Uri;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Display;
import android.webkit.WebView;
public class MyObj {
public Context ctx= null;
public JSONObject json = new JSONObject();
private CordovaActivity mGap;
public MediaRecorder mRecorder;
public static String fileName = "";
private MediaPlayer mPlayer = null;
public MyObj(CordovaActivity mGap){
this.mGap = mGap;
ctx = mGap.getApplicationContext();
}
public String ceshi(){
return "success";
}
public void recordSound(){
String fileDir = FileTool.getSDPath()+File.separator+"qqrecord"+File.separator;
File file = new File(fileDir);
if(!file.exists()){
file.mkdirs();
}
fileName = fileDir+UUID.randomUUID()+".aac";
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setOutputFile(fileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
try {
mRecorder.prepare();
mRecorder.start();
} catch (IOException e){
}
}
public void stopSound(){
mRecorder.stop();
mRecorder.release();
mRecorder = null;
}
public String getRecordFile(){
return fileName;
}
public void playAudio(String path){
String fileDir = FileTool.getSDPath()+File.separator+"qqrecord"+File.separator;
String filePath = "http://192.168.31.234:8080/qqserver/upload/"+path;
mPlayer = new MediaPlayer();
mPlayer.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer arg0) {
// TODO Auto-generated method stub
mPlayer.release();
mPlayer = null;
}
});
try{
mPlayer.setDataSource(filePath);
mPlayer.prepare();
mPlayer.start();
}catch(IOException e){
Log.e("phonegap","播放失败");
}
}
public String getScreenInfo() {
Display display = mGap.getWindowManager().getDefaultDisplay();
Point outPoint = new Point();
try {
Method method = display.getClass().getMethod("getRealSize",
new Class[] { Point.class });
try {
method.invoke(display, outPoint);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
JSONObject obj = new JSONObject();
Log.i("ScreenInfo", "invoke onCreate screenWidth: " + display.getWidth()
+ ", screenHeight: " + display.getHeight());
float aspectRatio = (float)display.getWidth() / (float)display.getHeight();
try {
obj.put("aspectRatio", aspectRatio);
obj.put("width", display.getWidth());
obj.put("height", display.getHeight());
} catch (JSONException e) {
e.printStackTrace();
}
return obj.toString();
}
/**
*
* @param activity
* @return > 0 success; <= 0 fail
*/
public int getStatusHeight(){
int statusHeight = 0;
Rect localRect = new Rect();
mGap.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect);
statusHeight = localRect.top;
if (0 == statusHeight){
Class<?> localClass;
try {
localClass = Class.forName("com.android.internal.R$dimen");
Object localObject = localClass.newInstance();
int i5 = Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString());
statusHeight = mGap.getResources().getDimensionPixelSize(i5);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (NumberFormatException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
return statusHeight;
}
public String getClientId(){
return SessionStorage.get("clientid");
}
public void showIntentActivityNotify(String title,String note,int id){
/*Notification notif = new Notification(R.drawable.icon, note, System.currentTimeMillis() );
notif.flags = Notification.FLAG_AUTO_CANCEL;
notif.defaults |= Notification.DEFAULT_SOUND;
notif.defaults |= Notification.DEFAULT_VIBRATE;
Intent notificationIntent = new Intent(ctx, MainActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(ctx, 0, notificationIntent, 0);
notif.setLatestEventInfo(ctx, title, note, contentIntent);
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager)
ctx.getSystemService(ns);
mNotificationManager.notify(id, notif);*/
}
public String getPath(String uri){
Uri contentUri = Uri.parse(uri);
String res = null;
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = ctx.getContentResolver().query(contentUri, proj, null, null, null);
if(cursor.moveToFirst()){;
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
res = cursor.getString(column_index);
}
cursor.close();
return res;
}
public void myshare(String subject, String text) {
// TODO Auto-generated method stub
Intent sendIntent = new Intent(android.content.Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
sendIntent.putExtra(android.content.Intent.EXTRA_TEXT, text);
this.mGap.startActivity(sendIntent);
}
/**
* 拨打电话
* @param tel
*/
public void toCall(String tel){
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:"+ tel));
mGap.startActivity(intent);
}
/**
* 调用系统发送短信
*/
public void sendMsg(String tel,String msg){
Uri smsToUri = Uri.parse("smsto:"+tel);
Intent mIntent = new Intent( android.content.Intent.ACTION_SE
没有合适的资源?快使用搜索试试~ 我知道了~
安卓课设代码安卓课设安卓课设代码安卓课设
共448个文件
png:216个
svg:100个
js:87个
需积分: 5 2 下载量 56 浏览量
2022-04-03
16:43:15
上传
评论
收藏 2.61MB RAR 举报
温馨提示
安卓课设代码安卓课设
资源详情
资源评论
资源推荐
收起资源包目录
安卓课设代码安卓课设安卓课设代码安卓课设 (448个子文件)
jquery.mobile-1.4.5.min.css 203KB
jquery.mobile-1.4.3.min.css 202KB
jquery.mobile.flatui.css 163KB
jquery.mobile.icons.min.css 124KB
skyd.css 120KB
skyd.min.css 80KB
theme-classic.css 67KB
swiper-3.3.1.min.css 17KB
index.css 10KB
ideascroll.css 1KB
ajax-loader.gif 8KB
ajax-loader.gif 6KB
index.html 33KB
cordova.jar 347KB
cordovaplugs.jar 229KB
MyObj.java 10KB
Plugs.java 10KB
FileTool.java 7KB
MainActivity.java 2KB
Command.java 2KB
SessionStorage.java 317B
1.jpg 251KB
s3.jpg 153KB
s2.jpg 108KB
s1.jpg 75KB
j3.jpg 45KB
j2.jpg 36KB
foo.jpg 24KB
2.jpg 14KB
j1.jpg 11KB
jquery.mobile-1.4.3.js 450KB
jquery.easyui.min.js 325KB
jquery.js 267KB
jquery.mobile-1.4.5.min.js 195KB
jquery.mobile-1.4.3.min.js 193KB
jquery.min.js 94KB
swiper-3.3.1.jquery.min.js 67KB
cordova.js 61KB
hammer.js 60KB
iscroll.js 49KB
jqueryform.js 48KB
yewu.js 23KB
globalization.js 16KB
cordova_plugins.js 14KB
FileReader.js 11KB
mymapsuper.js 10KB
cordovatools.js 10KB
Entry.js 10KB
FileWriter.js 9KB
geolocation.js 9KB
FileTransfer.js 8KB
Media.js 6KB
accelerometer.js 6KB
Contact.js 6KB
app.js 6KB
user.js 6KB
jbtool.js 5KB
vibration.js 5KB
notification.js 5KB
commontools.js 5KB
DirectoryEntry.js 5KB
compass.js 4KB
battery.js 4KB
inappbrowser.js 4KB
contacts.js 4KB
resolveLocalFileSystemURI.js 3KB
capture.js 3KB
statusbar.js 3KB
network.js 3KB
Camera.js 3KB
FileEntry.js 3KB
device.js 3KB
DirectoryReader.js 3KB
File.js 3KB
ProgressEvent.js 3KB
fileSystemPaths.js 2KB
requestFileSystem.js 2KB
notification.js 2KB
MediaError.js 2KB
CameraConstants.js 2KB
Coordinates.js 2KB
MediaFile.js 2KB
ContactFieldType.js 2KB
ideascroll.js 2KB
mymap.js 2KB
FileUploadOptions.js 2KB
CaptureError.js 2KB
ContactAddress.js 2KB
fileSystems-roots.js 2KB
FileSystem.js 2KB
ContactOrganization.js 1KB
FileTransferError.js 1KB
Metadata.js 1KB
FileError.js 1KB
ContactName.js 1KB
ContactError.js 1KB
CameraPopoverOptions.js 1KB
ContactFindOptions.js 1KB
MediaFileData.js 1KB
ContactField.js 1KB
共 448 条
- 1
- 2
- 3
- 4
- 5
ZhangBlossom
- 粉丝: 4w+
- 资源: 240
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Golang实现的加权pagerank算法实现.zip
- 基于Java实现的pagerank算法.zip
- 基于C++实现的pagerank算法.zip
- 基于Python实现的pagerank算法.zip
- java面试题-leetcode题解之第14题最长公共前缀.zip
- java面试题-leetcode题解之第28题找出字符串中第一个匹配项的下标.zip
- java面试题-leetcode题解之第31题下一个排列.zip
- java面试题-leetcode题解之第6题Z字形变换.zip
- java面试题-leetcode题解之第8题字符串转换整数atoi.zip
- java面试题-leetcode题解之第13题罗马数字转整数.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0