-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature added: the default transition
- Loading branch information
Showing
12 changed files
with
158 additions
and
32 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
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
65 changes: 65 additions & 0 deletions
65
doorbell/src/main/java/com/wujilin/doorbell/starter/AbstractStarter.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,65 @@ | ||
/* | ||
The MIT License (MIT) | ||
Copyright (c) 2015 Belin Wu (http://wujilin.com) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
package com.wujilin.doorbell.starter; | ||
|
||
import com.wujilin.doorbell.Starter; | ||
import com.wujilin.doorbell.Transition; | ||
|
||
import static com.wujilin.doorbell.Doorbell.getDefaultEnter; | ||
import static com.wujilin.doorbell.Doorbell.getDefaultExit; | ||
|
||
/** | ||
* The abstract implementation of the Starter interface. | ||
*/ | ||
public abstract class AbstractStarter implements Starter { | ||
private int enterId = getDefaultEnter(); | ||
private int exitId = getDefaultExit(); | ||
|
||
public AbstractStarter() { | ||
|
||
} | ||
|
||
public AbstractStarter(Transition transition) { | ||
if (transition == null) { | ||
return; | ||
} | ||
this.enterId = transition.getEnter(); | ||
this.exitId = transition.getExit(); | ||
} | ||
|
||
public AbstractStarter(int enterId, int exitId) { | ||
this.enterId = enterId; | ||
this.exitId = exitId; | ||
} | ||
|
||
@Override | ||
public int getEnter() { | ||
return enterId; | ||
} | ||
|
||
@Override | ||
public int getExit() { | ||
return exitId; | ||
} | ||
} |
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
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
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:duration="200" android:fromXDelta="-100.0%p" android:toXDelta="0.0" /> | ||
<alpha android:duration="200" android:fromAlpha="0.1" android:toAlpha="1.0" /> | ||
</set> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:duration="200" android:fromXDelta="0.0" android:toXDelta="100.0%p" /> | ||
<alpha android:duration="200" android:fromAlpha="1.0" android:toAlpha="0.1" /> | ||
</set> |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:duration="200" android:fromXDelta="100.0%p" android:toXDelta="0.0" /> | ||
<alpha android:duration="200" android:fromAlpha="0.1" android:toAlpha="1.0" /> | ||
</set> |
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,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:duration="200" android:fromXDelta="0.0" android:toXDelta="-100.0%p" /> | ||
<alpha android:duration="200" android:fromAlpha="1.0" android:toAlpha="0.1" /> | ||
</set> |