-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Widget switch 2. Vibration switch 3. Widget color picker 4. Dropped 'Close' button 5. Improved animation of widget expansion
- Loading branch information
Showing
16 changed files
with
316 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="by.yauhenl.gardine"> | ||
package="by.yauhenl.gardine" > | ||
|
||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
<uses-permission android:name="android.permission.VIBRATE"/> | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | ||
<uses-permission android:name="android.permission.VIBRATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name="by.yauhenl.gardine.MainActivity"> | ||
android:theme="@style/AppTheme" > | ||
<activity android:name=".MainActivity" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service | ||
android:label="@string/accessibility_service_name" | ||
android:name="by.yauhenl.gardine.GardineWidgetService" | ||
android:name=".GardineWidgetService" | ||
android:enabled="true" | ||
android:exported="false" | ||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"> | ||
android:label="@string/accessibility_service_name" | ||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE" > | ||
<intent-filter> | ||
<action android:name="android.accessibilityservice.AccessibilityService"/> | ||
<action android:name="android.accessibilityservice.AccessibilityService" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.accessibilityservice" | ||
android:resource="@xml/accessibilityservice"/> | ||
android:resource="@xml/accessibilityservice" /> | ||
</service> | ||
|
||
</application> | ||
|
||
</manifest> |
59 changes: 59 additions & 0 deletions
59
app/src/main/java/by/yauhenl/gardine/AntipodeViewsLayoutListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package by.yauhenl.gardine; | ||
|
||
import android.view.View; | ||
import android.view.ViewTreeObserver; | ||
|
||
import static android.view.View.GONE; | ||
import static android.view.View.INVISIBLE; | ||
import static android.view.View.VISIBLE; | ||
|
||
public class AntipodeViewsLayoutListener implements ViewTreeObserver.OnGlobalLayoutListener { | ||
|
||
private View a, b; | ||
private int av, bv; | ||
|
||
public AntipodeViewsLayoutListener(View a, View b) { | ||
this.a = a; | ||
this.b = b; | ||
this.setVisibility(); | ||
} | ||
|
||
@Override | ||
public void onGlobalLayout() { | ||
boolean aVisibilityChanged = a.getVisibility() != av; | ||
boolean bVisibilityChanged = b.getVisibility() != bv; | ||
|
||
this.setVisibility(); | ||
|
||
if (aVisibilityChanged) { | ||
this.inverse(a, b); | ||
} | ||
|
||
if (bVisibilityChanged) { | ||
this.inverse(b, a); | ||
} | ||
|
||
// At least one view has to be visible | ||
if(av == GONE && bv == GONE) { | ||
this.a.setVisibility(VISIBLE); | ||
} | ||
} | ||
|
||
private void setVisibility() { | ||
this.av = this.a.getVisibility(); | ||
this.bv = this.b.getVisibility(); | ||
} | ||
|
||
private void inverse(View v1, View v2) { | ||
switch (v1.getVisibility()) { | ||
case GONE: | ||
v2.setVisibility(VISIBLE); | ||
break; | ||
case VISIBLE: | ||
v2.setVisibility(GONE); | ||
break; | ||
case INVISIBLE: | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.