liuyuqi-dellpc 5 years ago
commit
d833686226

+ 9 - 0
.classpath

@@ -0,0 +1,9 @@
+<?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 exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+/bin
+/.settings
+/gen

+ 33 - 0
.project

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>ScreenFilter</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>

+ 36 - 0
AndroidManifest.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="me.yoqi.screenfilter"
+    android:versionCode="1"
+    android:versionName="1.0" >
+    
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="21" />
+	<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity android:name=".ScreenFilterActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".SettingsActivity"
+            android:label="@string/title_activity_settings" >
+        </activity>
+        
+        <receiver android:name=".LocaleReceiver">
+            <intent-filter>
+                <action android:name="com.twofortyfouram.locale.intent.action.FIRE_SETTING"/>
+            </intent-filter>
+        </receiver>
+    </application>
+
+</manifest>

BIN
ic_launcher-web.png


+ 20 - 0
proguard-project.txt

@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

+ 14 - 0
project.properties

@@ -0,0 +1,14 @@
+# 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 edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-21

BIN
res/drawable-hdpi/ic_launcher.png


BIN
res/drawable-mdpi/ic_launcher.png


BIN
res/drawable-xhdpi/ic_launcher.png


BIN
res/drawable-xxhdpi/ic_launcher.png


+ 8 - 0
res/layout/activity_screen_filter.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical" >
+    
+
+</LinearLayout>

+ 16 - 0
res/layout/activity_settings.xml

@@ -0,0 +1,16 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context="me.yoqi.screenfilter.SettingsActivity" >
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/hello_world" />
+
+</RelativeLayout>

+ 7 - 0
res/values/dimens.xml

@@ -0,0 +1,7 @@
+<resources>
+
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>

+ 9 - 0
res/values/strings.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">ScreenFilter</string>
+    <string name="title_activity_settings">SettingsActivity</string>
+    <string name="hello_world">Hello world!</string>
+    <string name="action_settings">Settings</string>
+
+</resources>

+ 20 - 0
res/values/styles.xml

@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>

+ 66 - 0
src/me/yoqi/screenfilter/FilterService.java

@@ -0,0 +1,66 @@
+package me.yoqi.screenfilter;
+
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.util.Log;
+
+public class FilterService extends Service {
+
+	private final IBinder binder = new LocalBinder();
+
+	public IBinder onBind(Intent paramIntent) {
+		return this.binder;
+	}
+
+//	public void onCreate() {
+//		super.onCreate();
+//		Log.d("FilterService", "onCreate");
+//		Notification localNotification = ScreenFilterActivity.getNotification(getBaseContext());
+//		try {
+//			getClass().getMethod("startForeground", new Class[] { Integer.TYPE, Notification.class }).invoke(this,
+//					new Object[] { Integer.valueOf(1), localNotification });
+//			return;
+//		} catch (Exception localException) {
+//			Log.w("ScreenFilter", "Error calling startForeground", localException);
+//			setForegroundBackwardsCompat(true);
+//			((NotificationManager) getSystemService("notification")).notify(1, localNotification);
+//		}
+//	}
+//
+//	public void onDestroy() {
+//		super.onDestroy();
+//		Log.d("FilterService", "onDestroy");
+//		setForegroundBackwardsCompat(false);
+//		ScreenFilterActivity.hideNotification(getBaseContext());
+//	}
+//
+//	public void onStart(Intent paramIntent, int paramInt) {
+//		super.onStart(paramIntent, paramInt);
+//		Log.d("FilterService", "onStart");
+//	}
+//
+//	void setForegroundBackwardsCompat(boolean paramBoolean) {
+//		try {
+//			getClass().getMethod("setForeground", new Class[] { Boolean.class }).invoke(this,
+//					new Object[] { Boolean.valueOf(paramBoolean) });
+//			return;
+//		} catch (Exception localException) {
+//			Log.w("ScreenFilter", "Error calling setForeground", localException);
+//		}
+//	}
+//
+	public class LocalBinder extends Binder {
+		public LocalBinder() {
+		
+		}
+
+		FilterService getService() {
+			return FilterService.this;
+		}
+	}
+
+}

+ 5 - 0
src/me/yoqi/screenfilter/FilterWidget.java

@@ -0,0 +1,5 @@
+package me.yoqi.screenfilter;
+
+public class FilterWidget {
+
+}

+ 5 - 0
src/me/yoqi/screenfilter/LocaleReceiver.java

@@ -0,0 +1,5 @@
+package me.yoqi.screenfilter;
+
+public class LocaleReceiver {
+
+}

+ 32 - 0
src/me/yoqi/screenfilter/ScreenFilterActivity.java

@@ -0,0 +1,32 @@
+package me.yoqi.screenfilter;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.WindowManager;
+
+public class ScreenFilterActivity extends Activity {
+
+	public static final String ACTION_FILTER_TOGGLED = "com.haxor.ScreenFilter.ACTION_FILTER_TOGGLED";
+	public static final String ACTION_FILTER_TOGGLED_EXTRA = "com.haxor.ScreenFilter.ACTION_FILTER_TOGGLED_EXTRA";
+	public static final int BRIGHTNESS_DEFAULT = 82;
+	public static final String NEW_BRIGHTNESS = "NEW_BRIGHTNESS";
+	public static final int NOTIFICATION_ID = 1;
+	public static final String PREFERENCES_FILE = "preferences";
+	public static final String SOFT_KEYS_ENABLED = "SOFT_KEYS_ENABLED";
+	public static final String TOO_LOW_CONFIRMED = "TOO_LOW_CONFIRMED";
+	public static final long WARNING_PERCENTAGE = 20L;
+	private static final long WARNING_TIME_MS = 10000L;
+	private static int currentProgress = -1;
+	private static boolean directlyInitiated = false;
+	private static View toastView;
+	private static WindowManager windowManager = null;
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		// TODO Auto-generated method stub
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_screen_filter);
+	}
+
+}

+ 13 - 0
src/me/yoqi/screenfilter/SettingsActivity.java

@@ -0,0 +1,13 @@
+package me.yoqi.screenfilter;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class SettingsActivity extends Activity {
+
+	@Override
+	protected void onCreate(Bundle savedInstanceState) {
+		super.onCreate(savedInstanceState);
+		setContentView(R.layout.activity_settings);
+	}
+}