-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
share backstack via Activity.getSystemService(), share key via Contex…
…tWrapper.getSystemService()
- Loading branch information
Showing
8 changed files
with
134 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Change log | ||
|
||
Simple Stack 0.1.1 (2017-01-14) | ||
--------------------------------- | ||
- Key and backstack are now provided to custom viewgroup via `getSystemService()` | ||
|
||
Simple Stack 0.1.0 (2017-01-13) | ||
--------------------------------- | ||
- Added initial `Backstack`, `StateChange` and `StateChanger` classes. | ||
- Backstack allows manipulation of state via `goTo()`, `goBack()` and `setHistory()`. | ||
- Demo persists backstack history through config change and process death. | ||
|
||
Limitations: | ||
- ViewState is not persisted | ||
- scheduling state changes (starting a state change while another is in progress) is not allowed | ||
- there is a possibility that state change can occur even after `onPause()` | ||
- key and backstack are manually set to the custom viewgroup, which means these are not directly accessible in their child views (and the interfaces are ugly anyways) |
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
11 changes: 0 additions & 11 deletions
11
...stack-example/src/main/java/com/zhuinden/simplestackdemoexample/demo/BackstackHolder.java
This file was deleted.
Oops, something went wrong.
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
45 changes: 45 additions & 0 deletions
45
...ack-example/src/main/java/com/zhuinden/simplestackdemoexample/demo/KeyContextWrapper.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,45 @@ | ||
package com.zhuinden.simplestackdemoexample.demo; | ||
|
||
import android.content.Context; | ||
import android.content.ContextWrapper; | ||
import android.os.Parcelable; | ||
import android.view.LayoutInflater; | ||
|
||
/** | ||
* Created by Zhuinden on 2017.01.14.. | ||
*/ | ||
|
||
public class KeyContextWrapper | ||
extends ContextWrapper { | ||
public static final String KEY = "KEY"; | ||
|
||
LayoutInflater layoutInflater; | ||
|
||
final Parcelable key; | ||
|
||
public KeyContextWrapper(Context base, Parcelable key) { | ||
super(base); | ||
this.key = key; | ||
} | ||
|
||
@Override | ||
public Object getSystemService(String name) { | ||
if(Context.LAYOUT_INFLATER_SERVICE.equals(name)) { | ||
if(layoutInflater == null) { | ||
layoutInflater = LayoutInflater.from(getBaseContext()).cloneInContext(this); | ||
} | ||
return layoutInflater; | ||
} else if(KEY.equals(name)) { | ||
return key; | ||
} | ||
return super.getSystemService(name); | ||
} | ||
|
||
|
||
public static <T extends Parcelable> T getKey(Context context) { | ||
// noinspection ResourceType | ||
Object key = context.getSystemService(KEY); | ||
// noinspection unchecked | ||
return (T) key; | ||
} | ||
} |
9 changes: 0 additions & 9 deletions
9
demo-stack-example/src/main/java/com/zhuinden/simplestackdemoexample/demo/KeyHolder.java
This file was deleted.
Oops, something went wrong.
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