Remove unused projects
This commit is contained in:
parent
d2e8847f49
commit
05ace97fb3
13 changed files with 0 additions and 530 deletions
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>BatteryLifeLog</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.anvisics.battery"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS"></uses-permission>
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name">
|
||||
<activity android:name=".BatteryViewActivity"
|
||||
android:label="@string/app_name">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service android:permission="android.permission.BATTERY_STATS" android:process="@string/batter_name_service" android:label="@string/batter_name_service" android:name=".BatteryLogService">
|
||||
<intent-filter><action android:name="com.anvisics.BatteryLogService"></action>
|
||||
</intent-filter>
|
||||
</service>
|
||||
<receiver android:name=".BatteryStatusReceiver">
|
||||
<intent-filter><action android:name="android.intent.action.BATTERY_CHANGED"></action>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_OWNER_DATA"></uses-permission>
|
||||
<uses-permission android:name="android.permission.READ_OWNER_DATA"></uses-permission>
|
||||
</manifest>
|
|
@ -1,13 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "build.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Indicates whether an apk should be generated for each density.
|
||||
split.density=false
|
||||
# Project target.
|
||||
target=android-3
|
Binary file not shown.
Before Width: | Height: | Size: 2.5 KiB |
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
>
|
||||
|
||||
<LinearLayout android:orientation="horizontal" android:id="@+id/LinearLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content">
|
||||
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/start_service">
|
||||
</Button>
|
||||
|
||||
<Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/stop_service"></Button>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<GridView android:id="@+id/GridView01" android:layout_width="wrap_content" android:layout_height="fill_parent" android:smoothScrollbar="true" android:numColumns="auto_fit" android:focusable="false">
|
||||
|
||||
</GridView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
</TextView>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/Exit" android:title="Exit" android:orderInCategory="2"></item>
|
||||
<item android:menuCategory="container" android:title="Clear All" android:alphabeticShortcut="A" android:id="@+id/Clear" android:orderInCategory="1"></item>
|
||||
|
||||
<item android:id="@+id/Export" android:title="Export To File"></item>
|
||||
</menu>
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, BatteryViewActivity!</string>
|
||||
<string name="app_name">BatteryLifeLog</string>
|
||||
<string name="start_service">Запустить сервис</string>
|
||||
<string name="stop_service">Остановить сервис</string>
|
||||
<color name="background">#FFFFFF</color>
|
||||
<string name="batter_name_service">Batter Log service</string>
|
||||
</resources>
|
|
@ -1,158 +0,0 @@
|
|||
package com.anvisics.battery;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.BatteryManager;
|
||||
import android.os.Binder;
|
||||
import android.os.IBinder;
|
||||
import android.text.format.DateFormat;
|
||||
|
||||
public class BatteryLogService extends Service {
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return binder;
|
||||
}
|
||||
|
||||
|
||||
private BatteryLogBinder binder = new BatteryLogBinder();
|
||||
private BatteryStatusReceiver batteryStatusReceiver;
|
||||
|
||||
|
||||
public static class BatteryLogEntry {
|
||||
private int batteryLevel;
|
||||
private int batteryVoltage;
|
||||
private long time;
|
||||
private int plugged;
|
||||
private int status;
|
||||
|
||||
|
||||
public BatteryLogEntry(){
|
||||
time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public int getPlugged() {
|
||||
return plugged;
|
||||
}
|
||||
public void setPlugged(int plugged) {
|
||||
this.plugged = plugged;
|
||||
}
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
public int getBatteryLevel() {
|
||||
return batteryLevel;
|
||||
}
|
||||
public void setBatteryLevel(int batteryLevel) {
|
||||
this.batteryLevel = batteryLevel;
|
||||
}
|
||||
public int getBatteryVoltage() {
|
||||
return batteryVoltage;
|
||||
}
|
||||
public void setBatteryVoltage(int batteryVoltage) {
|
||||
this.batteryVoltage = batteryVoltage;
|
||||
}
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public boolean sameMeasurements(BatteryLogEntry e ){
|
||||
return batteryLevel == e.batteryLevel &&
|
||||
batteryVoltage == e.batteryVoltage &&
|
||||
status == e.status &&
|
||||
plugged == e.plugged;
|
||||
}
|
||||
|
||||
public String getMessage(){
|
||||
String statusS = "";
|
||||
switch(status){
|
||||
case BatteryManager.BATTERY_STATUS_CHARGING : statusS = "CHARGING";
|
||||
case BatteryManager.BATTERY_STATUS_DISCHARGING: statusS = "DISCHARGING";
|
||||
case BatteryManager.BATTERY_STATUS_FULL: statusS = "FULL";
|
||||
case BatteryManager.BATTERY_STATUS_NOT_CHARGING: statusS = "NOT_CHARGING";
|
||||
}
|
||||
String pluggedS = "";
|
||||
switch(plugged){
|
||||
case BatteryManager.BATTERY_PLUGGED_AC: pluggedS = "PLUGGED_AC";
|
||||
case BatteryManager.BATTERY_PLUGGED_USB: pluggedS = "PLUGGED_USB";
|
||||
}
|
||||
CharSequence timeS = DateFormat.format("MM/dd/yy k:mm",this.time);
|
||||
return MessageFormat.format("{0} : battery ({1}), voltage ({2}), plugged ({3}), status ({4})",
|
||||
timeS, batteryLevel, batteryVoltage, pluggedS, statusS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class BatteryLogBinder extends Binder {
|
||||
|
||||
private List<BatteryLogEntry> entries = new ArrayList<BatteryLogEntry>();
|
||||
|
||||
|
||||
public boolean addEntry(BatteryLogEntry e){
|
||||
if(entries.isEmpty()){
|
||||
entries.add(e);
|
||||
return true;
|
||||
}
|
||||
BatteryLogEntry last = entries.get(entries.size() - 1);
|
||||
if(!last.sameMeasurements(e) || e.getTime() - last.getTime() > 60000){
|
||||
entries.add(e);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void clearEntries(){
|
||||
entries.clear();
|
||||
}
|
||||
public List<BatteryLogEntry> getEntries() {
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
batteryStatusReceiver = new BatteryStatusReceiver(this);
|
||||
registerReceiver(batteryStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||
|
||||
receiveMessage(100, 0, 0, 1);
|
||||
}
|
||||
|
||||
public void receiveMessage(int voltage, int level, int plugged, int status){
|
||||
BatteryLogEntry entry = new BatteryLogEntry();
|
||||
entry.setBatteryVoltage(voltage);
|
||||
entry.setBatteryLevel(level);
|
||||
entry.setPlugged(plugged);
|
||||
entry.setStatus(status);
|
||||
binder.addEntry(entry);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
unregisterReceiver(batteryStatusReceiver);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.anvisics.battery;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class BatteryStatusReceiver extends BroadcastReceiver {
|
||||
|
||||
private final BatteryLogService service;
|
||||
|
||||
public BatteryStatusReceiver(BatteryLogService service){
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
service.receiveMessage(intent.getIntExtra("voltage", -1), intent.getIntExtra("level", -1),
|
||||
intent.getIntExtra("plugged", -1), intent.getIntExtra("status", -1));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
package com.anvisics.battery;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridView;
|
||||
|
||||
import com.anvisics.battery.BatteryLogService.BatteryLogBinder;
|
||||
import com.anvisics.battery.BatteryLogService.BatteryLogEntry;
|
||||
|
||||
public class BatteryViewActivity extends Activity {
|
||||
private Button startServiceButton;
|
||||
private Button stopServiceButton;
|
||||
private GridView gridView;
|
||||
|
||||
|
||||
private final Intent serviceIntent = new Intent("com.anvisics.BatteryLogService");
|
||||
|
||||
ServiceConnection serviceConnection = null;
|
||||
private ArrayAdapter<BatteryLogEntry> gridViewAdapter;
|
||||
private BatteryLogBinder binder = null;
|
||||
|
||||
private class MyServiceConnection implements ServiceConnection {
|
||||
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
if(service instanceof BatteryLogBinder){
|
||||
gridViewAdapter.clear();
|
||||
binder = (BatteryLogBinder) service;
|
||||
List<BatteryLogEntry> entries = ((BatteryLogBinder) service).getEntries();
|
||||
for(int i = entries.size() - 1; i>=0; i--){
|
||||
gridViewAdapter.add(entries.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
gridViewAdapter.clear();
|
||||
binder = null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
|
||||
startServiceButton = (Button)findViewById(R.id.Button01);
|
||||
stopServiceButton = (Button)findViewById(R.id.Button02);
|
||||
|
||||
|
||||
|
||||
gridView = (GridView) findViewById(R.id.GridView01);
|
||||
|
||||
gridView.setNumColumns(1);
|
||||
gridView.setVerticalSpacing(3);
|
||||
gridViewAdapter = new ArrayAdapter<BatteryLogEntry>(getWindow().getContext(), R.layout.mytext);
|
||||
gridView.setAdapter(gridViewAdapter);
|
||||
|
||||
|
||||
startServiceButton.setOnClickListener(new OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ComponentName name = getWindow().getContext().startService(serviceIntent);
|
||||
if(name != null){
|
||||
stopServiceButton.setEnabled(true);
|
||||
startServiceButton.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
stopServiceButton.setOnClickListener(new OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean stopService = getWindow().getContext().stopService(serviceIntent);
|
||||
if(stopService){
|
||||
stopServiceButton.setEnabled(false);
|
||||
startServiceButton.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ComponentName componentName = getWindow().getContext().startService(serviceIntent);
|
||||
startServiceButton.setEnabled(componentName == null);
|
||||
stopServiceButton.setEnabled(componentName != null);
|
||||
serviceConnection = new MyServiceConnection();
|
||||
|
||||
|
||||
getWindow().getContext().bindService(serviceIntent, serviceConnection, 0);
|
||||
|
||||
}
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
MenuInflater inflater = getMenuInflater();
|
||||
inflater.inflate(R.menu.main_menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if(item.getItemId() == R.id.Clear){
|
||||
if(binder != null){
|
||||
binder.clearEntries();
|
||||
gridViewAdapter.clear();
|
||||
}
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.Export) {
|
||||
if (binder == null) {
|
||||
return true;
|
||||
}
|
||||
File directory = Environment.getExternalStorageDirectory();
|
||||
if (directory.canWrite()) {
|
||||
File f = new File(directory, "BatteryLog.txt");
|
||||
int i = 1;
|
||||
while (f.exists()) {
|
||||
f = new File(directory, "BatteryLog" + (++i) + ".txt");
|
||||
}
|
||||
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(
|
||||
new FileWriter(f));
|
||||
List<BatteryLogEntry> entries = binder.getEntries();
|
||||
for (i = entries.size() - 1; i >= 0; i--) {
|
||||
writer.write(entries.get(i).toString());
|
||||
}
|
||||
writer.close();
|
||||
binder.clearEntries();
|
||||
gridViewAdapter.clear();
|
||||
} catch (IOException e) {
|
||||
Log.e("batteryLog", "Can't export file", e);
|
||||
}
|
||||
}
|
||||
} else if(item.getItemId() == R.id.Exit){
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(serviceConnection != null){
|
||||
getWindow().getContext().unbindService(serviceConnection);
|
||||
serviceConnection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<hudson>
|
||||
<disabledAdministrativeMonitors/>
|
||||
<version>1.400</version>
|
||||
<numExecutors>1</numExecutors>
|
||||
<mode>NORMAL</mode>
|
||||
<useSecurity>true</useSecurity>
|
||||
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"/>
|
||||
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
|
||||
<disableSignup>true</disableSignup>
|
||||
<enableCaptcha>false</enableCaptcha>
|
||||
</securityRealm>
|
||||
<workspaceDir>${ITEM_ROOTDIR}/workspace</workspaceDir>
|
||||
<buildsDir>${ITEM_ROOTDIR}/builds</buildsDir>
|
||||
<markupFormatter class="hudson.markup.RawHtmlMarkupFormatter">
|
||||
<disableSyntaxHighlighting>false</disableSyntaxHighlighting>
|
||||
</markupFormatter>
|
||||
<jdks/>
|
||||
<viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
|
||||
<myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/>
|
||||
<clouds/>
|
||||
<slaves/>
|
||||
<quietPeriod>5</quietPeriod>
|
||||
<scmCheckoutRetryCount>0</scmCheckoutRetryCount>
|
||||
<views>
|
||||
<hudson.model.AllView>
|
||||
<owner class="hudson" reference="../../.."/>
|
||||
<name>All</name>
|
||||
<filterExecutors>false</filterExecutors>
|
||||
<filterQueue>false</filterQueue>
|
||||
<properties class="hudson.model.View$PropertyList"/>
|
||||
</hudson.model.AllView>
|
||||
</views>
|
||||
<primaryView>All</primaryView>
|
||||
<slaveAgentPort>0</slaveAgentPort>
|
||||
<label></label>
|
||||
<nodeProperties/>
|
||||
<globalNodeProperties/>
|
||||
</hudson>
|
Loading…
Reference in a new issue