diff --git a/.gitignore b/.gitignore index 34eb2a9..39fb081 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,9 @@ -# built application files -*.apk -*.ap_ - -# files for the dex VM -*.dex - -# Java class files -*.class - -# generated files -bin/ -gen/ - -# Local configuration file (sdk path, etc) -local.properties - +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries .DS_Store +/build +/captures +.externalNativeBuild diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..05a242d --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..ddcb790 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..3b31283 --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,7 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..7158618 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.8 + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..70eccf2 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/StandOutLib/.gitignore b/StandOutLib/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/StandOutLib/.gitignore @@ -0,0 +1 @@ +/build diff --git a/StandOutLib/build.gradle b/StandOutLib/build.gradle new file mode 100644 index 0000000..1d811c3 --- /dev/null +++ b/StandOutLib/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.3" + publishNonDefault true // to make Build.DEBUG work correctly... + + defaultConfig { + minSdkVersion 15 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + debug { + debuggable true + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.1' + testCompile 'junit:junit:4.12' +} diff --git a/advanced/floatingfolders/proguard-project.txt b/StandOutLib/proguard-rules.pro similarity index 52% rename from advanced/floatingfolders/proguard-project.txt rename to StandOutLib/proguard-rules.pro index f2fe155..a8efc0f 100644 --- a/advanced/floatingfolders/proguard-project.txt +++ b/StandOutLib/proguard-rules.pro @@ -1,11 +1,8 @@ -# 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. +# in C:\android\android-sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html @@ -18,3 +15,11 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/StandOutLib/src/androidTest/java/wei/mark/standout/ExampleInstrumentedTest.java b/StandOutLib/src/androidTest/java/wei/mark/standout/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2d7979d --- /dev/null +++ b/StandOutLib/src/androidTest/java/wei/mark/standout/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package wei.mark.standout; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("wei.mark.standout.test", appContext.getPackageName()); + } +} diff --git a/StandOutLib/src/main/AndroidManifest.xml b/StandOutLib/src/main/AndroidManifest.xml new file mode 100644 index 0000000..a491c03 --- /dev/null +++ b/StandOutLib/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/library/src/wei/mark/standout/StandOutWindow.java b/StandOutLib/src/main/java/wei/mark/standout/StandOutWindow.java similarity index 90% rename from library/src/wei/mark/standout/StandOutWindow.java rename to StandOutLib/src/main/java/wei/mark/standout/StandOutWindow.java index 26cbbcd..90a0f08 100644 --- a/library/src/wei/mark/standout/StandOutWindow.java +++ b/StandOutLib/src/main/java/wei/mark/standout/StandOutWindow.java @@ -13,11 +13,14 @@ import android.app.Service; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.os.IBinder; +import android.support.v4.app.NotificationCompat; +import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.Gravity; @@ -35,6 +38,7 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.PopupWindow; +import android.widget.RemoteViews; import android.widget.TextView; /** @@ -91,14 +95,19 @@ public abstract class StandOutWindow extends Service { */ public static final String ACTION_SEND_DATA = "SEND_DATA"; - /** - * Intent action: Hide an existing window with an existing id. To enable the - * ability to restore this window, make sure you implement - * {@link #getHiddenNotification(int)}. - */ - public static final String ACTION_HIDE = "HIDE"; + /** + * Intent action: Hide an existing window with an existing id. To enable the + * ability to restore this window, make sure you implement + * {@link #getHiddenNotification(int)}. + */ + public static final String ACTION_HIDE = "HIDE"; - /** + /** + * Intent action: Toggle visibility of an existing window with an existing id. + */ + public static final String ACTION_TOGGLE_VIS = "TOGGLE_VIS"; + + /** * Show a new window corresponding to the id, or restore a previously hidden * window. * @@ -233,28 +242,49 @@ public static Intent getShowIntent(Context context, .setData(uri); } - /** - * See {@link #hide(Context, Class, int)}. - * - * @param context - * A Context of the application package implementing this class. - * @param cls - * The Service extending {@link StandOutWindow} that is managing - * the window. - * @param id - * The id representing this window. If the id exists, and the - * corresponding window was previously hidden, then that window - * will be restored. - * @return An {@link Intent} to use with - * {@link Context#startService(Intent)}. - */ - public static Intent getHideIntent(Context context, - Class cls, int id) { - return new Intent(context, cls).putExtra("id", id).setAction( - ACTION_HIDE); - } - - /** + /** + * See {@link #hide(Context, Class, int)}. + * + * @param context + * A Context of the application package implementing this class. + * @param cls + * The Service extending {@link StandOutWindow} that is managing + * the window. + * @param id + * The id representing this window. If the id exists, and the + * corresponding window was previously hidden, then that window + * will be restored. + * @return An {@link Intent} to use with + * {@link Context#startService(Intent)}. + */ + public static Intent getHideIntent(Context context, + Class cls, int id) { + return new Intent(context, cls).putExtra("id", id).setAction( + ACTION_HIDE); + } + + /** + * See {@link #hide(Context, Class, int)}. + * + * @param context + * A Context of the application package implementing this class. + * @param cls + * The Service extending {@link StandOutWindow} that is managing + * the window. + * @param id + * The id representing this window. If the id exists, and the + * corresponding window was previously hidden, then that window + * will be restored. If it's visible, it will be hidden. + * @return An {@link Intent} to use with + * {@link Context#startService(Intent)}. + */ + public static Intent getToggleVisIntent(Context context, + Class cls, int id) { + return new Intent(context, cls).putExtra("id", id).setAction( + ACTION_TOGGLE_VIS); + } + + /** * See {@link #close(Context, Class, int)}. * * @param context @@ -380,7 +410,9 @@ public int onStartCommand(Intent intent, int flags, int startId) { if (ACTION_SHOW.equals(action) || ACTION_RESTORE.equals(action)) { show(id); } else if (ACTION_HIDE.equals(action)) { - hide(id); + hide(id); + } else if (ACTION_TOGGLE_VIS.equals(action)) { + toggleVis(id); } else if (ACTION_CLOSE.equals(action)) { close(id); } else if (ACTION_CLOSE_ALL.equals(action)) { @@ -607,6 +639,10 @@ public Intent getHiddenNotificationIntent(int id) { return null; } + public RemoteViews getPersistentNotificationRemoteViews(int id) { + return null; + } + /** * Return a persistent {@link Notification} for the corresponding id. You * must return a notification for AT LEAST the first id to be requested. @@ -655,12 +691,29 @@ public Notification getPersistentNotification(int id) { PendingIntent.FLAG_UPDATE_CURRENT); } - Notification notification = new Notification(icon, tickerText, when); - notification.setLatestEventInfo(c, contentTitle, contentText, - contentIntent); - return notification; + NotificationCompat.Builder nb = new NotificationCompat.Builder(getApplicationContext()) + .setSmallIcon(icon) + .setContentTitle(contentTitle) + .setContentText(contentText) + .setTicker(tickerText) + .setContentIntent(contentIntent) + // don't want it on lock screen, but still shows if no secure lock or user + // selected not to hide sensitive notifications... + .setVisibility(NotificationCompat.VISIBILITY_SECRET) + .setWhen(when); + RemoteViews rv = getPersistentNotificationRemoteViews(id); + if (rv != null) + nb.setContent(rv); + + return nb.build(); } + @Override + public void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + Window.updateScreenSize(this); + } + /** * Return a hidden {@link Notification} for the corresponding id. The system * will request a notification for every id that is hidden. @@ -679,6 +732,11 @@ public Notification getPersistentNotification(int id) { * @return The {@link Notification} corresponding to the id or null. */ public Notification getHiddenNotification(int id) { + // the difference here is we are providing the same id + Intent notificationIntent = getHiddenNotificationIntent(id); + if (notificationIntent == null) + return null; + // same basics as getPersistentNotification() int icon = getHiddenIcon(); long when = System.currentTimeMillis(); @@ -687,9 +745,6 @@ public Notification getHiddenNotification(int id) { String contentText = getHiddenNotificationMessage(id); String tickerText = String.format("%s: %s", contentTitle, contentText); - // the difference here is we are providing the same id - Intent notificationIntent = getHiddenNotificationIntent(id); - PendingIntent contentIntent = null; if (notificationIntent != null) { @@ -698,10 +753,15 @@ public Notification getHiddenNotification(int id) { // flag updates existing persistent notification PendingIntent.FLAG_UPDATE_CURRENT); } + Notification notification = new NotificationCompat.Builder(getApplicationContext()) + .setSmallIcon(icon) + .setContentTitle(contentTitle) + .setContentText(contentText) + .setTicker(tickerText) + .setContentIntent(contentIntent) + .setWhen(when) + .setVisibility(NotificationCompat.VISIBILITY_PUBLIC).build(); - Notification notification = new Notification(icon, tickerText, when); - notification.setLatestEventInfo(c, contentTitle, contentText, - contentIntent); return notification; } @@ -773,7 +833,7 @@ public PopupWindow getDropDown(final int id) { if (dropDownListItems != null) { items = dropDownListItems; } else { - items = new ArrayList(); + items = new ArrayList(); } // add default drop down items @@ -1058,6 +1118,38 @@ public boolean onKeyEvent(int id, Window window, KeyEvent event) { return false; } + public final void updatePersistentNotification(int id) { + Notification notification = getPersistentNotification(id); + + // show the notification + if (notification != null) { + notification.flags = notification.flags + | Notification.FLAG_NO_CLEAR; + + // only show notification if not shown before + if (!startedForeground) { + // tell Android system to show notification + startForeground( + getClass().hashCode() + ONGOING_NOTIFICATION_ID, + notification); + startedForeground = true; + } else { + // update notification if shown before + mNotificationManager.notify(getClass().hashCode() + + ONGOING_NOTIFICATION_ID, notification); + } + } else { + // notification can only be null if it was provided before + if (!startedForeground) { + throw new RuntimeException("Your StandOutWindow service must" + + "provide a persistent notification." + + "The notification prevents Android" + + "from killing your service in low" + + "memory situations."); + } + } + } + /** * Show or restore a window corresponding to the id. Return the window that * was shown/restored. @@ -1115,35 +1207,7 @@ public final synchronized Window show(int id) { sWindowCache.putCache(id, getClass(), window); // get the persistent notification - Notification notification = getPersistentNotification(id); - - // show the notification - if (notification != null) { - notification.flags = notification.flags - | Notification.FLAG_NO_CLEAR; - - // only show notification if not shown before - if (!startedForeground) { - // tell Android system to show notification - startForeground( - getClass().hashCode() + ONGOING_NOTIFICATION_ID, - notification); - startedForeground = true; - } else { - // update notification if shown before - mNotificationManager.notify(getClass().hashCode() - + ONGOING_NOTIFICATION_ID, notification); - } - } else { - // notification can only be null if it was provided before - if (!startedForeground) { - throw new RuntimeException("Your StandOutWindow service must" - + "provide a persistent notification." - + "The notification prevents Android" - + "from killing your service in low" - + "memory situations."); - } - } + updatePersistentNotification(id); focus(id); @@ -1181,9 +1245,6 @@ public final synchronized void hide(int id) { if (Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_HIDE_ENABLE)) { window.visibility = Window.VISIBILITY_TRANSITION; - // get the hidden notification for this view - Notification notification = getHiddenNotification(id); - // get animation Animation animation = getHideAnimation(id); @@ -1216,20 +1277,43 @@ public void onAnimationEnd(Animation animation) { ex.printStackTrace(); } - // display the notification - notification.flags = notification.flags - | Notification.FLAG_NO_CLEAR - | Notification.FLAG_AUTO_CANCEL; - - mNotificationManager.notify(getClass().hashCode() + id, - notification); + // get the hidden notification for this view + Notification notification = getHiddenNotification(id); + if (notification != null) { + // display the notification + notification.flags = notification.flags + | Notification.FLAG_NO_CLEAR + | Notification.FLAG_AUTO_CANCEL; + mNotificationManager.notify(getClass().hashCode() + id, + notification); + } + else { + // Update persistent nofification + updatePersistentNotification(id); + } } else { // if hide not enabled, close window close(id); } } + public final synchronized void toggleVis(final int id) { + // get the view corresponding to the id + final Window window = getWindow(id); + + if (window == null) { + throw new IllegalArgumentException("Tried to toggle visibility(" + id + + ") a null window."); + } + + // ignore if window is already hidden + if (window.visibility == Window.VISIBILITY_GONE) + show(id); + else + hide(id); + } + /** * Close a window corresponding to the id. * diff --git a/library/src/wei/mark/standout/Utils.java b/StandOutLib/src/main/java/wei/mark/standout/Utils.java similarity index 100% rename from library/src/wei/mark/standout/Utils.java rename to StandOutLib/src/main/java/wei/mark/standout/Utils.java diff --git a/library/src/wei/mark/standout/WindowCache.java b/StandOutLib/src/main/java/wei/mark/standout/WindowCache.java similarity index 100% rename from library/src/wei/mark/standout/WindowCache.java rename to StandOutLib/src/main/java/wei/mark/standout/WindowCache.java diff --git a/library/src/wei/mark/standout/constants/StandOutFlags.java b/StandOutLib/src/main/java/wei/mark/standout/constants/StandOutFlags.java similarity index 100% rename from library/src/wei/mark/standout/constants/StandOutFlags.java rename to StandOutLib/src/main/java/wei/mark/standout/constants/StandOutFlags.java diff --git a/library/src/wei/mark/standout/ui/TouchInfo.java b/StandOutLib/src/main/java/wei/mark/standout/ui/TouchInfo.java similarity index 100% rename from library/src/wei/mark/standout/ui/TouchInfo.java rename to StandOutLib/src/main/java/wei/mark/standout/ui/TouchInfo.java diff --git a/library/src/wei/mark/standout/ui/Window.java b/StandOutLib/src/main/java/wei/mark/standout/ui/Window.java similarity index 99% rename from library/src/wei/mark/standout/ui/Window.java rename to StandOutLib/src/main/java/wei/mark/standout/ui/Window.java index 610372b..4f7ee43 100644 --- a/library/src/wei/mark/standout/ui/Window.java +++ b/StandOutLib/src/main/java/wei/mark/standout/ui/Window.java @@ -77,7 +77,7 @@ public class Window extends FrameLayout { /** * Width and height of the screen. */ - int displayWidth, displayHeight; + static int displayWidth, displayHeight; /** * Context of the window. @@ -104,11 +104,7 @@ public Window(final StandOutWindow context, final int id) { this.touchInfo = new TouchInfo(); touchInfo.ratio = (float) originalParams.width / originalParams.height; this.data = new Bundle(); - DisplayMetrics metrics = mContext.getResources() - .getDisplayMetrics(); - displayWidth = metrics.widthPixels; - displayHeight = (int) (metrics.heightPixels - 25 * metrics.density); - + updateScreenSize(mContext); // create the window contents View content; FrameLayout body; @@ -170,6 +166,12 @@ public boolean onTouch(View v, MotionEvent event) { setTag(body.getTag()); } + public static void updateScreenSize(Context context) { + DisplayMetrics metrics = context.getResources().getDisplayMetrics(); + displayWidth = metrics.widthPixels; + displayHeight = (int) (metrics.heightPixels - 25 * metrics.density); + } + @Override public boolean onInterceptTouchEvent(MotionEvent event) { StandOutLayoutParams params = getLayoutParams(); diff --git a/library/res/drawable-hdpi/border.9.png b/StandOutLib/src/main/res/drawable-hdpi/border.9.png similarity index 100% rename from library/res/drawable-hdpi/border.9.png rename to StandOutLib/src/main/res/drawable-hdpi/border.9.png diff --git a/library/res/drawable-hdpi/border_focused.9.png b/StandOutLib/src/main/res/drawable-hdpi/border_focused.9.png similarity index 100% rename from library/res/drawable-hdpi/border_focused.9.png rename to StandOutLib/src/main/res/drawable-hdpi/border_focused.9.png diff --git a/library/res/drawable-hdpi/close.png b/StandOutLib/src/main/res/drawable-hdpi/close.png similarity index 100% rename from library/res/drawable-hdpi/close.png rename to StandOutLib/src/main/res/drawable-hdpi/close.png diff --git a/library/res/drawable-hdpi/corner.png b/StandOutLib/src/main/res/drawable-hdpi/corner.png similarity index 100% rename from library/res/drawable-hdpi/corner.png rename to StandOutLib/src/main/res/drawable-hdpi/corner.png diff --git a/library/res/drawable-hdpi/hide.png b/StandOutLib/src/main/res/drawable-hdpi/hide.png similarity index 100% rename from library/res/drawable-hdpi/hide.png rename to StandOutLib/src/main/res/drawable-hdpi/hide.png diff --git a/library/res/drawable-hdpi/maximize.png b/StandOutLib/src/main/res/drawable-hdpi/maximize.png similarity index 100% rename from library/res/drawable-hdpi/maximize.png rename to StandOutLib/src/main/res/drawable-hdpi/maximize.png diff --git a/library/res/layout/drop_down_list_item.xml b/StandOutLib/src/main/res/layout/drop_down_list_item.xml similarity index 100% rename from library/res/layout/drop_down_list_item.xml rename to StandOutLib/src/main/res/layout/drop_down_list_item.xml diff --git a/library/res/layout/system_window_decorators.xml b/StandOutLib/src/main/res/layout/system_window_decorators.xml similarity index 100% rename from library/res/layout/system_window_decorators.xml rename to StandOutLib/src/main/res/layout/system_window_decorators.xml diff --git a/library/res/values/strings.xml b/StandOutLib/src/main/res/values/strings.xml similarity index 100% rename from library/res/values/strings.xml rename to StandOutLib/src/main/res/values/strings.xml diff --git a/StandOutLib/src/test/java/wei/mark/standout/ExampleUnitTest.java b/StandOutLib/src/test/java/wei/mark/standout/ExampleUnitTest.java new file mode 100644 index 0000000..a468195 --- /dev/null +++ b/StandOutLib/src/test/java/wei/mark/standout/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package wei.mark.standout; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/advanced/floatingfolders/.classpath b/advanced/floatingfolders/.classpath deleted file mode 100644 index a4763d1..0000000 --- a/advanced/floatingfolders/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/advanced/floatingfolders/.project b/advanced/floatingfolders/.project deleted file mode 100644 index 657d152..0000000 --- a/advanced/floatingfolders/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - FloatingFolders - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/advanced/floatingfolders/AndroidManifest.xml b/advanced/floatingfolders/AndroidManifest.xml deleted file mode 100644 index 27d7dab..0000000 --- a/advanced/floatingfolders/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/advanced/floatingfolders/README.md b/advanced/floatingfolders/README.md deleted file mode 100644 index eb18e85..0000000 --- a/advanced/floatingfolders/README.md +++ /dev/null @@ -1,3 +0,0 @@ -Floating-Folders -================ -![Floating Folders](https://dl.dropbox.com/u/30367/hosted/floating%20folders.png) \ No newline at end of file diff --git a/advanced/floatingfolders/lint.xml b/advanced/floatingfolders/lint.xml deleted file mode 100644 index 9c834f4..0000000 --- a/advanced/floatingfolders/lint.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/advanced/floatingfolders/project.properties b/advanced/floatingfolders/project.properties deleted file mode 100644 index c742528..0000000 --- a/advanced/floatingfolders/project.properties +++ /dev/null @@ -1,15 +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 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-7 -android.library.reference.1=../../library diff --git a/advanced/floatingfolders/res/values/colors.xml b/advanced/floatingfolders/res/values/colors.xml deleted file mode 100644 index 0bfa301..0000000 --- a/advanced/floatingfolders/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - #33b5e5 - - \ No newline at end of file diff --git a/advanced/floatingfolders/res/values/strings.xml b/advanced/floatingfolders/res/values/strings.xml deleted file mode 100644 index 236838b..0000000 --- a/advanced/floatingfolders/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - Floating Folders - - \ No newline at end of file diff --git a/advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFoldersLauncher.java b/advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFoldersLauncher.java deleted file mode 100644 index 9458b6b..0000000 --- a/advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFoldersLauncher.java +++ /dev/null @@ -1,18 +0,0 @@ -package wei.mark.floatingfolders; - -import wei.mark.standout.StandOutWindow; -import android.app.Activity; -import android.os.Bundle; - -public class FloatingFoldersLauncher extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - StandOutWindow.closeAll(this, FloatingFolder.class); - FloatingFolder.showFolders(this); - - finish(); - } -} diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..14fa65c --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,32 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 25 + buildToolsVersion "25.0.3" + defaultConfig { + applicationId "wei.mark.standouttest" + minSdkVersion 15 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + debug { + debuggable true + dependencies { + debugCompile project(path: ':StandOutLib', configuration: 'debug') + } + } + } +} + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) + androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + exclude group: 'com.android.support', module: 'support-annotations' + }) + compile 'com.android.support:appcompat-v7:25.3.1' + compile 'com.android.support.constraint:constraint-layout:1.0.2' + testCompile 'junit:junit:4.12' +} diff --git a/example/proguard-project.txt b/app/proguard-rules.pro similarity index 52% rename from example/proguard-project.txt rename to app/proguard-rules.pro index f2fe155..a8efc0f 100644 --- a/example/proguard-project.txt +++ b/app/proguard-rules.pro @@ -1,11 +1,8 @@ -# 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. +# in C:\android\android-sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html @@ -18,3 +15,11 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/wei/mark/standouttest/ExampleInstrumentedTest.java b/app/src/androidTest/java/wei/mark/standouttest/ExampleInstrumentedTest.java new file mode 100644 index 0000000..c80d7d9 --- /dev/null +++ b/app/src/androidTest/java/wei/mark/standouttest/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package wei.mark.standouttest; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.assertEquals; + +/** + * Instrumentation test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("wei.mark.standouttest", appContext.getPackageName()); + } +} diff --git a/example/AndroidManifest.xml b/app/src/main/AndroidManifest.xml similarity index 53% rename from example/AndroidManifest.xml rename to app/src/main/AndroidManifest.xml index 231c96c..8971d0d 100644 --- a/example/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,22 +1,21 @@ + package="wei.mark.standouttest"> - + - + + android:theme="@style/Theme.AppCompat.Translucent" + > @@ -24,14 +23,17 @@ - + - + + + - + + \ No newline at end of file diff --git a/app/src/main/java/wei/mark/standouttest/MainActivity.java b/app/src/main/java/wei/mark/standouttest/MainActivity.java new file mode 100644 index 0000000..d950e4f --- /dev/null +++ b/app/src/main/java/wei/mark/standouttest/MainActivity.java @@ -0,0 +1,61 @@ +package wei.mark.standouttest; + +import android.content.Intent; +import android.net.Uri; +import android.os.Build; +import android.provider.Settings; +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +import wei.mark.standouttest.floatingfolders.FloatingFolder; +import wei.mark.standout.StandOutWindow; + +public class MainActivity extends AppCompatActivity { + public final static int REQUEST_CODE = 101; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + if (Build.VERSION.SDK_INT >= 23 && !Settings.canDrawOverlays(this)) { + /** if not construct intent to request permission */ + Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, + Uri.parse("package:" + getPackageName())); + /** request permission via start activity for result */ + startActivityForResult(intent, REQUEST_CODE); + return; + } + + showOverlay(); + } + + private void showOverlay() { + StandOutWindow.closeAll(this, SimpleWindow.class); + StandOutWindow.closeAll(this, MultiWindow.class); + StandOutWindow.closeAll(this, WidgetsWindow.class); + StandOutWindow.closeAll(this, FloatingFolder.class); + + // Remove comments as needed to test different parts of the library +// StandOutWindow.show(this, MostBasicWindow.class, StandOutWindow.DEFAULT_ID); +// StandOutWindow.show(this, SimpleWindow.class, StandOutWindow.DEFAULT_ID); + StandOutWindow.show(this, MultiWindow.class, StandOutWindow.DEFAULT_ID); + StandOutWindow.show(this, WidgetsWindow.class, StandOutWindow.DEFAULT_ID); +// FloatingFolder.showFolders(this); + + finish(); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == REQUEST_CODE) { + // if so check once again if we have permission */ + if (Build.VERSION.SDK_INT >= 23 && Settings.canDrawOverlays(this)) { + showOverlay(); + } + else { + finish(); + } + } + } +} diff --git a/example/src/wei/mark/example/MostBasicWindow.java b/app/src/main/java/wei/mark/standouttest/MostBasicWindow.java similarity index 95% rename from example/src/wei/mark/example/MostBasicWindow.java rename to app/src/main/java/wei/mark/standouttest/MostBasicWindow.java index b0e87a5..c56de9b 100644 --- a/example/src/wei/mark/example/MostBasicWindow.java +++ b/app/src/main/java/wei/mark/standouttest/MostBasicWindow.java @@ -1,4 +1,4 @@ -package wei.mark.example; +package wei.mark.standouttest; import wei.mark.standout.StandOutWindow; import wei.mark.standout.ui.Window; diff --git a/example/src/wei/mark/example/MultiWindow.java b/app/src/main/java/wei/mark/standouttest/MultiWindow.java similarity index 98% rename from example/src/wei/mark/example/MultiWindow.java rename to app/src/main/java/wei/mark/standouttest/MultiWindow.java index 8d380f7..918e441 100644 --- a/example/src/wei/mark/example/MultiWindow.java +++ b/app/src/main/java/wei/mark/standouttest/MultiWindow.java @@ -1,4 +1,4 @@ -package wei.mark.example; +package wei.mark.standouttest; import java.util.ArrayList; import java.util.List; @@ -73,7 +73,8 @@ public StandOutLayoutParams getParams(int id, Window window) { // front @Override public int getFlags(int id) { - return StandOutFlags.FLAG_DECORATION_SYSTEM + return 0 + | StandOutFlags.FLAG_DECORATION_SYSTEM | StandOutFlags.FLAG_BODY_MOVE_ENABLE | StandOutFlags.FLAG_WINDOW_HIDE_ENABLE | StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP diff --git a/example/src/wei/mark/example/SimpleWindow.java b/app/src/main/java/wei/mark/standouttest/SimpleWindow.java similarity index 97% rename from example/src/wei/mark/example/SimpleWindow.java rename to app/src/main/java/wei/mark/standouttest/SimpleWindow.java index d84540d..4cf49c2 100644 --- a/example/src/wei/mark/example/SimpleWindow.java +++ b/app/src/main/java/wei/mark/standouttest/SimpleWindow.java @@ -1,12 +1,13 @@ -package wei.mark.example; +package wei.mark.standouttest; -import wei.mark.standout.StandOutWindow; -import wei.mark.standout.constants.StandOutFlags; -import wei.mark.standout.ui.Window; import android.content.Intent; import android.view.LayoutInflater; import android.widget.FrameLayout; +import wei.mark.standout.StandOutWindow; +import wei.mark.standout.constants.StandOutFlags; +import wei.mark.standout.ui.Window; + public class SimpleWindow extends StandOutWindow { @Override diff --git a/example/src/wei/mark/example/WidgetsWindow.java b/app/src/main/java/wei/mark/standouttest/WidgetsWindow.java similarity index 98% rename from example/src/wei/mark/example/WidgetsWindow.java rename to app/src/main/java/wei/mark/standouttest/WidgetsWindow.java index 82e2b59..2f065ae 100644 --- a/example/src/wei/mark/example/WidgetsWindow.java +++ b/app/src/main/java/wei/mark/standouttest/WidgetsWindow.java @@ -1,4 +1,4 @@ -package wei.mark.example; +package wei.mark.standouttest; import wei.mark.standout.ui.Window; import android.os.Bundle; diff --git a/advanced/floatingfolders/src/wei/mark/floatingfolders/AppAdapter.java b/app/src/main/java/wei/mark/standouttest/floatingfolders/AppAdapter.java similarity index 96% rename from advanced/floatingfolders/src/wei/mark/floatingfolders/AppAdapter.java rename to app/src/main/java/wei/mark/standouttest/floatingfolders/AppAdapter.java index 60647af..ed944df 100644 --- a/advanced/floatingfolders/src/wei/mark/floatingfolders/AppAdapter.java +++ b/app/src/main/java/wei/mark/standouttest/floatingfolders/AppAdapter.java @@ -1,4 +1,4 @@ -package wei.mark.floatingfolders; +package wei.mark.standouttest.floatingfolders; import java.util.List; @@ -13,6 +13,8 @@ import android.widget.ImageView; import android.widget.TextView; +import wei.mark.standouttest.R; + public class AppAdapter extends ArrayAdapter { class ViewHolder { ImageView icon; diff --git a/advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFolder.java b/app/src/main/java/wei/mark/standouttest/floatingfolders/FloatingFolder.java similarity index 99% rename from advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFolder.java rename to app/src/main/java/wei/mark/standouttest/floatingfolders/FloatingFolder.java index 4bea0f6..23b50a9 100644 --- a/advanced/floatingfolders/src/wei/mark/floatingfolders/FloatingFolder.java +++ b/app/src/main/java/wei/mark/standouttest/floatingfolders/FloatingFolder.java @@ -1,4 +1,4 @@ -package wei.mark.floatingfolders; +package wei.mark.standouttest.floatingfolders; import java.io.ByteArrayOutputStream; import java.io.FileInputStream; @@ -13,6 +13,8 @@ import wei.mark.standout.StandOutWindow; import wei.mark.standout.constants.StandOutFlags; import wei.mark.standout.ui.Window; +import wei.mark.standouttest.R; + import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -92,7 +94,7 @@ public String getAppName() { @Override public int getAppIcon() { - return R.drawable.ic_launcher; + return R.drawable.ic_folder; } @Override diff --git a/advanced/floatingfolders/src/wei/mark/floatingfolders/FlowLayout.java b/app/src/main/java/wei/mark/standouttest/floatingfolders/FlowLayout.java similarity index 98% rename from advanced/floatingfolders/src/wei/mark/floatingfolders/FlowLayout.java rename to app/src/main/java/wei/mark/standouttest/floatingfolders/FlowLayout.java index 1592652..be1fa39 100644 --- a/advanced/floatingfolders/src/wei/mark/floatingfolders/FlowLayout.java +++ b/app/src/main/java/wei/mark/standouttest/floatingfolders/FlowLayout.java @@ -1,4 +1,4 @@ -package wei.mark.floatingfolders; +package wei.mark.standouttest.floatingfolders; import android.content.Context; import android.util.AttributeSet; diff --git a/advanced/floatingfolders/src/wei/mark/floatingfolders/FolderModel.java b/app/src/main/java/wei/mark/standouttest/floatingfolders/FolderModel.java similarity index 89% rename from advanced/floatingfolders/src/wei/mark/floatingfolders/FolderModel.java rename to app/src/main/java/wei/mark/standouttest/floatingfolders/FolderModel.java index e88e22e..1829311 100644 --- a/advanced/floatingfolders/src/wei/mark/floatingfolders/FolderModel.java +++ b/app/src/main/java/wei/mark/standouttest/floatingfolders/FolderModel.java @@ -1,4 +1,4 @@ -package wei.mark.floatingfolders; +package wei.mark.standouttest.floatingfolders; import java.util.ArrayList; import java.util.List; diff --git a/advanced/floatingfolders/res/drawable-hdpi/folder.9.png b/app/src/main/res/drawable-hdpi/folder.9.png similarity index 100% rename from advanced/floatingfolders/res/drawable-hdpi/folder.9.png rename to app/src/main/res/drawable-hdpi/folder.9.png diff --git a/advanced/floatingfolders/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_folder.png similarity index 100% rename from advanced/floatingfolders/res/drawable-hdpi/ic_launcher.png rename to app/src/main/res/drawable-hdpi/ic_folder.png diff --git a/advanced/floatingfolders/res/drawable-hdpi/ic_menu_archive.png b/app/src/main/res/drawable-hdpi/ic_menu_archive.png similarity index 100% rename from advanced/floatingfolders/res/drawable-hdpi/ic_menu_archive.png rename to app/src/main/res/drawable-hdpi/ic_menu_archive.png diff --git a/advanced/floatingfolders/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png b/app/src/main/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png similarity index 100% rename from advanced/floatingfolders/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png rename to app/src/main/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png diff --git a/advanced/floatingfolders/res/drawable-hdpi/original_ic_launcher.png b/app/src/main/res/drawable-hdpi/original_ic_launcher.png similarity index 100% rename from advanced/floatingfolders/res/drawable-hdpi/original_ic_launcher.png rename to app/src/main/res/drawable-hdpi/original_ic_launcher.png diff --git a/advanced/floatingfolders/res/drawable-ldpi/ic_launcher.png b/app/src/main/res/drawable-ldpi/ic_folder.png similarity index 100% rename from advanced/floatingfolders/res/drawable-ldpi/ic_launcher.png rename to app/src/main/res/drawable-ldpi/ic_folder.png diff --git a/advanced/floatingfolders/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_folder.png similarity index 100% rename from advanced/floatingfolders/res/drawable-mdpi/ic_launcher.png rename to app/src/main/res/drawable-mdpi/ic_folder.png diff --git a/advanced/floatingfolders/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_folder.png similarity index 100% rename from advanced/floatingfolders/res/drawable-xhdpi/ic_launcher.png rename to app/src/main/res/drawable-xhdpi/ic_folder.png diff --git a/advanced/floatingfolders/res/layout/app_row.xml b/app/src/main/res/layout/app_row.xml similarity index 100% rename from advanced/floatingfolders/res/layout/app_row.xml rename to app/src/main/res/layout/app_row.xml diff --git a/advanced/floatingfolders/res/layout/app_selector.xml b/app/src/main/res/layout/app_selector.xml similarity index 100% rename from advanced/floatingfolders/res/layout/app_selector.xml rename to app/src/main/res/layout/app_selector.xml diff --git a/advanced/floatingfolders/res/layout/app_square.xml b/app/src/main/res/layout/app_square.xml similarity index 95% rename from advanced/floatingfolders/res/layout/app_square.xml rename to app/src/main/res/layout/app_square.xml index fe4c959..bed80d0 100644 --- a/advanced/floatingfolders/res/layout/app_square.xml +++ b/app/src/main/res/layout/app_square.xml @@ -15,7 +15,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:src="@drawable/ic_launcher" /> + android:src="@drawable/ic_folder" /> - - + + + #3F51B5 + #303F9F + #FF4081 + #33b5e5 + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..eb65b62 --- /dev/null +++ b/app/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + StandOutTest + diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cac0b69 --- /dev/null +++ b/app/src/main/res/values/styles.xml @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/app/src/test/java/wei/mark/standouttest/ExampleUnitTest.java b/app/src/test/java/wei/mark/standouttest/ExampleUnitTest.java new file mode 100644 index 0000000..e458c69 --- /dev/null +++ b/app/src/test/java/wei/mark/standouttest/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package wei.mark.standouttest; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d0aa704 --- /dev/null +++ b/build.gradle @@ -0,0 +1,23 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.2' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/example/.classpath b/example/.classpath deleted file mode 100644 index a4763d1..0000000 --- a/example/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/example/.project b/example/.project deleted file mode 100644 index bbd1c64..0000000 --- a/example/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - StandOutExample - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/example/project.properties b/example/project.properties deleted file mode 100644 index bc68e05..0000000 --- a/example/project.properties +++ /dev/null @@ -1,15 +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 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-7 -android.library.reference.1=../library diff --git a/example/res/drawable-hdpi/ic_launcher.png b/example/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index 96a442e..0000000 Binary files a/example/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/example/res/drawable-ldpi/ic_launcher.png b/example/res/drawable-ldpi/ic_launcher.png deleted file mode 100644 index 9923872..0000000 Binary files a/example/res/drawable-ldpi/ic_launcher.png and /dev/null differ diff --git a/example/res/drawable-mdpi/ic_launcher.png b/example/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 359047d..0000000 Binary files a/example/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/example/res/drawable-xhdpi/ic_launcher.png b/example/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 71c6d76..0000000 Binary files a/example/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/example/res/values/strings.xml b/example/res/values/strings.xml deleted file mode 100644 index d928f62..0000000 --- a/example/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - StandOut Example - - \ No newline at end of file diff --git a/example/src/wei/mark/example/StandOutExampleActivity.java b/example/src/wei/mark/example/StandOutExampleActivity.java deleted file mode 100644 index a7163b8..0000000 --- a/example/src/wei/mark/example/StandOutExampleActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -package wei.mark.example; - -import wei.mark.standout.StandOutWindow; -import android.app.Activity; -import android.os.Bundle; - -public class StandOutExampleActivity extends Activity { - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - StandOutWindow.closeAll(this, SimpleWindow.class); - StandOutWindow.closeAll(this, MultiWindow.class); - StandOutWindow.closeAll(this, WidgetsWindow.class); - - // show a MultiWindow, SimpleWindow - - StandOutWindow - .show(this, SimpleWindow.class, StandOutWindow.DEFAULT_ID); - StandOutWindow.show(this, MultiWindow.class, StandOutWindow.DEFAULT_ID); - StandOutWindow.show(this, WidgetsWindow.class, - StandOutWindow.DEFAULT_ID); - - // show a MostBasicWindow. It is commented out because it does not - // support closing. - - /* - * StandOutWindow.show(this, StandOutMostBasicWindow.class, - * StandOutWindow.DEFAULT_ID); - */ - - finish(); - } -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..aac7c9b --- /dev/null +++ b/gradle.properties @@ -0,0 +1,17 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..13372ae Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..b8d24f3 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Thu May 25 16:12:44 EDT 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/gradlew b/gradlew new file mode 100644 index 0000000..9d82f78 --- /dev/null +++ b/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..8a0b282 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/library/.classpath b/library/.classpath deleted file mode 100644 index a4763d1..0000000 --- a/library/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/library/.project b/library/.project deleted file mode 100644 index 1a3df9d..0000000 --- a/library/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - StandOut - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/library/AndroidManifest.xml b/library/AndroidManifest.xml deleted file mode 100644 index b88fcaf..0000000 --- a/library/AndroidManifest.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/library/build.xml b/library/build.xml deleted file mode 100644 index 067b60c..0000000 --- a/library/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/library/lint.xml b/library/lint.xml deleted file mode 100644 index ee0eead..0000000 --- a/library/lint.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/library/proguard-project.txt b/library/proguard-project.txt deleted file mode 100644 index f2fe155..0000000 --- a/library/proguard-project.txt +++ /dev/null @@ -1,20 +0,0 @@ -# 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 *; -#} diff --git a/library/project.properties b/library/project.properties deleted file mode 100644 index 5ca3505..0000000 --- a/library/project.properties +++ /dev/null @@ -1,15 +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 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-7 -android.library=true diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..6c6b37f --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include ':app', ':StandOutLib'