-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First approach, just using a utility class to restore activity graph. :)
- Loading branch information
Showing
9 changed files
with
161 additions
and
48 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
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
55 changes: 55 additions & 0 deletions
55
app/src/main/java/me/panavtec/cleancontacts/ui/ConfigurationHandler.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,55 @@ | ||
package me.panavtec.cleancontacts.ui; | ||
|
||
import android.os.Handler; | ||
import android.os.Message; | ||
import hugo.weaving.DebugLog; | ||
|
||
public class ConfigurationHandler { | ||
|
||
private static final int MSG_REALLY_DESTROYED = 1; | ||
private ConfigurationHandlerListener configurationHandlerListener; | ||
|
||
static interface ConfigurationHandlerListener { | ||
void destroyThemAll(); | ||
} | ||
|
||
public ConfigurationHandler(ConfigurationHandlerListener configurationHandlerListener) { | ||
this.configurationHandlerListener = configurationHandlerListener; | ||
} | ||
|
||
boolean mStopped; | ||
boolean mReallyStopped; | ||
|
||
Handler mHandler = new Handler() { | ||
@DebugLog @Override public void handleMessage(Message msg) { | ||
switch (msg.what) { | ||
case MSG_REALLY_DESTROYED: | ||
if (mStopped) { | ||
doReallyDestroy(); | ||
mHandler = null; | ||
} | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
void doReallyDestroy() { | ||
if (!mReallyStopped) { | ||
mReallyStopped = true; | ||
mHandler.removeMessages(MSG_REALLY_DESTROYED); | ||
configurationHandlerListener.destroyThemAll(); | ||
} | ||
} | ||
|
||
public void destroy() { | ||
mStopped = true; | ||
mHandler.sendEmptyMessage(MSG_REALLY_DESTROYED); | ||
} | ||
|
||
public void create() { | ||
mStopped = false; | ||
mReallyStopped = false; | ||
mHandler.removeMessages(MSG_REALLY_DESTROYED); | ||
} | ||
|
||
} |
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
Oops, something went wrong.