安卓手電筒軟件使用說(shuō)明書(shū)_第1頁(yè)
安卓手電筒軟件使用說(shuō)明書(shū)_第2頁(yè)
安卓手電筒軟件使用說(shuō)明書(shū)_第3頁(yè)
安卓手電筒軟件使用說(shuō)明書(shū)_第4頁(yè)
安卓手電筒軟件使用說(shuō)明書(shū)_第5頁(yè)
已閱讀5頁(yè),還剩60頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、目 錄第一部分 設(shè)計(jì)說(shuō)明11.1 軟件概況11.2 軟件可行性研究11.3 流程圖21.4 使用環(huán)境2第二部分 軟件功能介紹32.1 打開(kāi)軟件32.2 屏幕燈光42.3 警示燈52.4 警燈62.5 SOS求救信號(hào)6第三部分 注意事項(xiàng)73.1 使用注意73.2 源代碼7第一部分 設(shè)計(jì)說(shuō)明1.1 軟件概況手電筒Free軟件(以下簡(jiǎn)稱(chēng)軟件),是用Java語(yǔ)言編寫(xiě)的安卓手機(jī)軟件,最主要的功能是可以打開(kāi)手機(jī)閃光燈在黑暗環(huán)境下實(shí)現(xiàn)照明功能。本軟件還能實(shí)現(xiàn)屏幕燈光及其色彩調(diào)節(jié),警示燈,警燈,SOS求救信號(hào)等實(shí)用功能。1.2 軟件可行性研究 本軟件主要是黑暗環(huán)境下照明使用,手電筒隨身攜帶不方便,利用本軟件可

2、以很好的解決這個(gè)問(wèn)題。而且軟件操作界面簡(jiǎn)潔,操作容易上手。任何人都可以使用,沒(méi)有技術(shù)門(mén)檻。1.3 流程圖1.4 使用環(huán)境(1) 黑暗環(huán)境(2) 需要屏幕燈光的環(huán)境(3) 需要警示燈,警燈,SOS求救信號(hào)的環(huán)境第二部分 軟件功能介紹2.1 打開(kāi)軟件打開(kāi)軟件后,就會(huì)出現(xiàn)下面的主界面。 主界面很簡(jiǎn)潔,上面部分是軟件的名字,中間部分是顯示電量,往下在屏幕的中央是開(kāi)關(guān)按鈕,再往下有一個(gè)框,如果在框中打鉤的話(huà),每次啟動(dòng)軟件后會(huì)自動(dòng)打開(kāi)閃關(guān)燈。最下面是五個(gè)按鈕。左側(cè)四個(gè)是功能按鈕,不同圖標(biāo)對(duì)應(yīng)著各自的功能,從左至右依次為屏幕燈光,警示燈,警燈,SOS求救信號(hào)。用戶(hù)可通過(guò)點(diǎn)按圖標(biāo)打開(kāi)對(duì)應(yīng)功能,操作十分簡(jiǎn)便。具

3、體功能及其操作詳見(jiàn)2.2-2.4。2.2 屏幕燈光點(diǎn)擊屏幕燈光按鈕時(shí)會(huì)出現(xiàn)下面的界面屏幕最下面是各種顏色的按鈕,例如點(diǎn)擊藍(lán)色就會(huì)出現(xiàn)藍(lán)色的界面。一共可以顯示八種顏色,點(diǎn)擊不同顏色按鈕,屏幕就會(huì)出現(xiàn)相應(yīng)的顏色界面。 2.3 警示燈點(diǎn)擊該按鈕后·會(huì)出現(xiàn)警示燈界面上下兩個(gè)燈可以輪流閃亮,在特定的情況下可以起到一定的警示作用。2.4 警燈打開(kāi)此按鈕,會(huì)出現(xiàn)紅色和藍(lán)色交替閃爍的界面,以模仿警燈。2.5 SOS求救信號(hào)。點(diǎn)擊此按鈕,會(huì)出現(xiàn)紅色閃爍的界面。此功能為某些特殊的情況尤其在危急情況下而設(shè)計(jì),必要的時(shí)候可用來(lái)求救以脫離險(xiǎn)境。第三部分 注意事項(xiàng)3.1 使用注意長(zhǎng)時(shí)間使用會(huì)導(dǎo)致電量消耗過(guò)快,而

4、且可能會(huì)對(duì)閃關(guān)燈造成損害,請(qǐng)注意使用時(shí)間,注意合理使用。 3.2 源代碼package com.flashlightfree;import java.io.IOException;import java.util.List;import java.util.Random;import com.flashlightfree.R;import com.google.ads.AdRequest;import com.google.ads.AdSize;import com.google.ads.AdView;import android.media.AudioManager;import andro

5、id.media.MediaPlayer;import .Uri;import android.os.Bundle;import android.app.Activity;import android.app.AlertDialog;import android.app.Dialog;import android.app.Service;import android.content.BroadcastReceiver;import android.content.Context;import android.content.DialogInterface;import android.cont

6、ent.Intent;import android.content.IntentFilter;import android.content.SharedPreferences;import android.content.pm.PackageInfo;import android.content.pm.PackageManager;import android.content.pm.ResolveInfo;import android.content.pm.PackageManager.NameNotFoundException;import android.graphics.Color;im

7、port android.graphics.Typeface;import android.util.Log;import android.view.KeyEvent;import android.view.Menu;import android.view.View;import android.view.animation.Animation;import android.view.animation.AnimationUtils;import android.widget.Button;import android.widget.CheckBox;import android.widget

8、.ImageView;import android.widget.LinearLayout;import android.widget.TextView;public class Main extends Activity private static String Setting_Info = "setting_infos"protected static final String Ad_Block="adblock"private static final String Auto_Start_LED = "autostartled"

9、;private MediaPlayer mMediaPlayer;private AdView adView;private int adblock=0;private Button powerbtn;private TextView batterytv;private TextView titletv;private PowerLED powerled; private int batterystatusimgs=R.drawable.battery1,R.drawable.battery2,R.drawable.battery3;private int batterystatusperc

10、ent=75,30,0;private int gift_imgs=R.drawable.giftbox1,R.drawable.giftbox2,R.drawable.giftbox3;private int title_color=Color.rgb(51, 51, 51),Color.rgb(48, 210, 255);private String adappname;private String adpackname;private String adappdesc;private String adappicon;private String adappimage;private B

11、utton fun1_btn;private Button fun2_btn;private Button fun3_btn;private Button fun4_btn;private Button fun5_btn;private Button gift_btn;private SharedPreferences settings_info;private int autostarled;private CheckBox autocheck;private int userrate=0;Overrideprotected void onCreate(Bundle savedInstanc

12、eState) super.onCreate(savedInstanceState);setContentView(R.layout.main);powerbtn= (Button) findViewById(R.id.powerbtn);batterytv= (TextView) findViewById(R.id.batterytv);titletv= (TextView) findViewById(R.id.titletv);mMediaPlayer=new MediaPlayer();autocheck= (CheckBox) findViewById(R.id.autocheck);

13、fun1_btn= (Button) findViewById(R.id.fun1_btn);fun2_btn= (Button) findViewById(R.id.fun2_btn);fun3_btn= (Button) findViewById(R.id.fun3_btn);fun4_btn= (Button) findViewById(R.id.fun4_btn);fun5_btn= (Button) findViewById(R.id.fun5_btn);gift_btn= (Button) findViewById(R.id.gift_btn);Typeface fonttype

14、= Typeface.createFromAsset(this.getAssets(),"fonts/justusitalic.ttf");titletv.setTypeface(fonttype);settings_info = getSharedPreferences(Setting_Info, 0);adblock= settings_info.getInt(Ad_Block,0);autostarled= settings_info.getInt(Auto_Start_LED,1);if(autostarled=1)playSounds(R.raw.turnon);

15、powerled=new PowerLED();registerReceiver(mBatInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED);if(adblock=1) LinearLayout layout = (LinearLayout) findViewById(R.id.admainLayout); layout.setVisibility(View.GONE); else adView = new AdView(this, AdSize.BANNER, "a151b8cb70e64fd");

16、LinearLayout layout = (LinearLayout) findViewById(R.id.admainLayout); layout.addView(adView); adView.loadAd(new AdRequest(); titletv.setTextColor(title_color0);if(!powerled.m_isOn&&autostarled=1)autocheck.setChecked(true);powerled.turnOn();powerbtn.setBackgroundResource(R.drawable.poweron);t

17、itletv.setTextColor(title_color1); Animation animation = AnimationUtils.loadAnimation(Main.this, R.anim.gradually); powerbtn.setAnimation(animation);elseAnimation animation = AnimationUtils.loadAnimation(Main.this, R.anim.turnoff);animation.setFillAfter(true); powerbtn.setAnimation(animation);View.O

18、nClickListener VClick=new View.OnClickListener() private Intent it;Overridepublic void onClick(View v) / TODO Auto-generated method stubswitch(v.getId()case R.id.powerbtn:playSounds(R.raw.click);if(!powerled.m_isOn)powerled.turnOn();powerbtn.setBackgroundResource(R.drawable.poweron);titletv.setTextC

19、olor(title_color1); Animation animation = AnimationUtils.loadAnimation(Main.this, R.anim.turnon); powerbtn.setAnimation(animation);elsepowerled.turnOff();powerbtn.setBackgroundResource(R.drawable.poweroff);titletv.setTextColor(title_color0);Animation animation = AnimationUtils.loadAnimation(Main.thi

20、s, R.anim.turnoff);animation.setFillAfter(true); powerbtn.setAnimation(animation);break;case R.id.gift_btn: String applink2="market:/details?id="+adpackname; Uri uri2 = Uri.parse(applink2); it = new Intent(Intent.ACTION_VIEW, uri2); startActivity(it);break;case R.id.fun1_btn: it = new Inte

21、nt(Main.this, Fun1.class); startActivity(it);break;case R.id.fun2_btn: it = new Intent(Main.this, Fun2.class); startActivity(it);break;case R.id.fun3_btn: it = new Intent(Main.this, Fun3.class); startActivity(it);break;case R.id.fun4_btn: if(powerled.m_isOn) powerled.turnOff(); powerbtn.setBackgroun

22、dResource(R.drawable.poweroff); titletv.setTextColor(title_color0); Animation animation = AnimationUtils.loadAnimation(Main.this, R.anim.turnoff);animation.setFillAfter(true); powerbtn.setAnimation(animation); powerled.Destroy(); it = new Intent(Main.this, Fun4.class); startActivityForResult(it,4);b

23、reak;case R.id.autocheck:if(autocheck.isChecked()settings_info.edit().putInt(Auto_Start_LED, 1).commit();elsesettings_info.edit().putInt(Auto_Start_LED, 0).commit();break;case R.id.fun5_btn:break;powerbtn.setOnClickListener(VClick);gift_btn.setOnClickListener(VClick);fun1_btn.setOnClickListener(VCli

24、ck);fun2_btn.setOnClickListener(VClick);fun3_btn.setOnClickListener(VClick);fun4_btn.setOnClickListener(VClick);fun5_btn.setOnClickListener(VClick);autocheck.setOnClickListener(VClick);Override public void onDestroy() super.onDestroy(); if(adblock=0) adView.destroy(); powerled.Destroy(); unregisterR

25、eceiver(mBatInfoReceiver); private BroadcastReceiver mBatInfoReceiver = new BroadcastReceiver() Override public void onReceive(Context context, Intent intent) String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action) int intLevel = intent.getIntExtra("level", 0);

26、 int intScale = intent.getIntExtra("scale", 100); onBatteryInfoReceiver(intLevel, intScale); ; public void onBatteryInfoReceiver(int intLevel, int intScale) int bp=intLevel * 100 / intScale; batterytv.setText( bp + "%"); if(bp>=batterystatuspercent2) batterytv.setBackgroundRes

27、ource(batterystatusimgs2); if(bp>=batterystatuspercent1) batterytv.setBackgroundResource(batterystatusimgs1); if(bp>=batterystatuspercent0) batterytv.setBackgroundResource(batterystatusimgs0); Override public boolean onKeyDown(int keyCode, KeyEvent event) AudioManager audioManager=null; audioM

28、anager=(AudioManager)getSystemService(Service.AUDIO_SERVICE); if(keyCode=KeyEvent.KEYCODE_VOLUME_DOWN) /Toast.makeText(main.this, "Down", Toast.LENGTH_SHORT).show(); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return tru

29、e; else if(keyCode=KeyEvent.KEYCODE_VOLUME_UP) audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; else if(keyCode=KeyEvent.KEYCODE_BACK) powerled.turnOff();powerbtn.setBackgroundResource(R.drawable.poweroff);titletv.setTextC

30、olor(title_color0); return super.onKeyDown(keyCode, event); else return super.onKeyDown(keyCode, event); private boolean isRunApp(String packageName) PackageInfo pi; try pi = getPackageManager().getPackageInfo(packageName, 0); Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null); / resolveInt

31、ent.addCategory(Intent.CATEGORY_LAUNCHER); resolveIntent.setPackage(pi.packageName); PackageManager pManager = getPackageManager(); List<ResolveInfo> apps = pManager.queryIntentActivities( resolveIntent, 0); ResolveInfo ri = apps.iterator().next(); if (ri != null) return true; else return fals

32、e; catch (NameNotFoundException e) / TODO Auto-generated catch block e.printStackTrace(); return false; Override protected void onResume() super.onResume();protected void onActivityResult(int requestCode, int resultCode, Intent data) super.onActivityResult(requestCode, resultCode, data); if (data !=

33、 null) if (requestCode = 4) powerled=new PowerLED(); private void playSounds(int sid) if (mMediaPlayer != null) if (mMediaPlayer.isPlaying() mMediaPlayer.stop();mMediaPlayer.release();mMediaPlayer = null;mMediaPlayer = MediaPlayer.create(Main.this, sid);/* 準(zhǔn)備播放 */ mMediaPlayer.prepare();/* 開(kāi)始播放 */mM

34、ediaPlayer.start();package com.flashlightfree;import com.flashlightfree.R;import com.google.ads.AdRequest;import com.google.ads.AdSize;import com.google.ads.AdView;import android.app.Activity;import android.content.Intent;import android.graphics.Color;import .Uri;import android.os.Bundle;import andr

35、oid.os.Handler;import android.view.GestureDetector;import android.view.GestureDetector.OnGestureListener;import android.view.MotionEvent;import android.view.View;import android.view.View.OnTouchListener;import android.view.WindowManager;import android.widget.Button;import android.widget.LinearLayout

36、;import android.widget.RelativeLayout;import android.widget.TextView;import android.widget.Toast;public class Fun1 extends Activity implements OnTouchListener,OnGestureListener private Button fun_btns;private int bgcolor=Color.rgb(255,255,255),Color.rgb(255,0,0),Color.rgb(0,255,0),Color.rgb(0,0,255)

37、,Color.rgb(255,255,0),Color.rgb(255,192,203),Color.rgb(128,0,128),Color.rgb(255,127,39);private Handler show_handler;private Runnable show_runnable;private float brightnessnumber=0.70f;private int adblock=0;private AdView adView;private GestureDetector mGestureDetector; private boolean firsttime=tru

38、e;private TextView titletv;public Fun1() mGestureDetector = new GestureDetector( this ); Overrideprotected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState);setContentView(R.layout.fun1); fun_btns=new Button8;fun_btns0= (Button) findViewById(R.id.fun1_btn);fun_btns1= (Butto

39、n) findViewById(R.id.fun2_btn);fun_btns2= (Button) findViewById(R.id.fun3_btn);fun_btns3= (Button) findViewById(R.id.fun4_btn);fun_btns4= (Button) findViewById(R.id.fun5_btn);fun_btns5= (Button) findViewById(R.id.fun6_btn);fun_btns6= (Button) findViewById(R.id.fun7_btn);fun_btns7= (Button) findViewB

40、yId(R.id.fun8_btn);titletv= (TextView) findViewById(R.id.titletv);RelativeLayout bglayout = (RelativeLayout) findViewById(R.id.bglayout);bglayout.setOnTouchListener( this ); bglayout.setFocusable( true ); bglayout.setClickable( true ); bglayout.setLongClickable( true );for(int i=0;i<fun_btns.leng

41、th;i+)fun_btnsi.setBackgroundColor(bgcolori);if(adblock=1) LinearLayout layout = (LinearLayout) findViewById(R.id.admainLayout); layout.setVisibility(View.GONE); else adView = new AdView(this, AdSize.BANNER, "a151b8cb70e64fd"); LinearLayout layout = (LinearLayout) findViewById(R.id.admainL

42、ayout); layout.addView(adView); adView.loadAd(new AdRequest(); setBrightness(brightnessnumber);View.OnClickListener VClick=new View.OnClickListener() Overridepublic void onClick(View v) / TODO Auto-generated method stubtitletv.setVisibility(View.INVISIBLE);for(int i=0;i<fun_btns.length;i+)if(v.eq

43、uals(fun_btnsi)RelativeLayout bglayout = (RelativeLayout) findViewById(R.id.bglayout);bglayout.setBackgroundColor(bgcolori);for(int i=0;i<fun_btns.length;i+)fun_btnsi.setOnClickListener(VClick);show_handler = new Handler();show_runnable = new Runnable() Overridepublic void run() brightnessnumber=

44、brightnessnumber+0.05f;setBrightness(brightnessnumber);if(brightnessnumber<1.0f)show_handler.postDelayed(this,100);mGestureDetector.setIsLongpressEnabled( true ); public void setBrightness(float f) WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness = f; getWindow().s

45、etAttributes(lp); Override protected void onResume() super.onResume(); if(firsttime) firsttime=false; show_handler.postDelayed(show_runnable,100); Override public void onDestroy() super.onDestroy(); show_handler.removeCallbacks(show_runnable); if(adblock=0) adView.destroy(); Overridepublic boolean o

46、nTouch(View arg0, MotionEvent arg1) / TODO Auto-generated method stubreturn mGestureDetector.onTouchEvent(arg1); Overridepublic boolean onDown(MotionEvent arg0) / TODO Auto-generated method stubreturn false;Overridepublic boolean onFling(MotionEvent arg0, MotionEvent arg1, float arg2,float arg3) / T

47、ODO Auto-generated method stubfloat movedistance =arg1.getX()-arg0.getX();int indenumber=(int) (movedistance/100.0f);brightnessnumber=brightnessnumber+(float) indenumber*0.05f;if(brightnessnumber>1.0)brightnessnumber=1.0f;if(brightnessnumber<0.1)brightnessnumber=0.1f;setBrightness(brightnessnu

48、mber);return false;Overridepublic void onLongPress(MotionEvent arg0) / TODO Auto-generated method stubOverridepublic boolean onScroll(MotionEvent arg0, MotionEvent arg1, float arg2,float arg3) / TODO Auto-generated method stubreturn false;Overridepublic void onShowPress(MotionEvent arg0) / TODO Auto-generated method stubOverridepublic boolean onSingleTapUp(MotionEvent arg0) / TODO Auto-generated method stubreturn false;package com.flashlightfree;import com.flashlightfree.R;

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論