GitHub PullRequestReviewCommentEvent at 2014-03-31 16:00:33
Repository: mortar
Actor: pyricau
Payload: {"comment":{"url":"https://api.github.com/repos/square/mortar/pulls/comments/11122362","id":11122362,"diff_hunk":"@@ -19,16 +19,45 @@\n import android.os.Parcelable;\n \n /**\n- * @param <D> the type of info this dialog displays. T must provide value-based implementations\n+ * @param <D> the type of info this dialog displays. D must provide value-based implementations\n  * of {@link #hashCode()} and {@link #equals(Object)} in order for debouncing code in {@link #show}\n  * to work properly.\n+ *\n+ * When using multiple {@PopupPresenter}s of the same type in the same view, construct them with\n+ * {@link #PopupPresenter(String)} to give them a name to distinguish them.\n  */\n public abstract class PopupPresenter<D extends Parcelable, R> extends Presenter<Popup<D, R>> {\n-  private static String KEY = \"popup\";\n-  private static boolean WITH_FLOURISH = true;\n+  private static final String WHAT_TO_SHOW_KEY_SUFFIX = \"_what_to_show\";\n+  private static final String VIEW_STATE_KEY_SUFFIX = \"_view_state\";\n+  private static final boolean WITH_FLOURISH = true;\n \n   private D whatToShow;\n \n+  private final String whatToShowKey;\n+  private final String popupStateKey;\n+\n+  /**\n+   * @param customStateKey custom key name for saving state, useful when you have multiple instance\n+   * of the same PopupPresenter class tied to a view.\n+   */\n+  protected PopupPresenter(String customStateKey) {\n+    String stateKey = stateKey(customStateKey);\n+    this.whatToShowKey = stateKey + WHAT_TO_SHOW_KEY_SUFFIX;\n+    this.popupStateKey = stateKey + VIEW_STATE_KEY_SUFFIX;\n+  }\n+\n+  protected PopupPresenter() {\n+    this(null);","path":"mortar/src/main/java/mortar/PopupPresenter.java","position":35,"original_position":35,"commit_id":"52dd4da328cb00a1793182dd4d14120f975791bc","original_commit_id":"52dd4da328cb00a1793182dd4d14120f975791bc","user":{"login":"pyricau","id":557033,"avatar_url":"https://avatars.githubusercontent.com/u/557033?","gravatar_id":"06c6a07275076c6b525e2b14018ad78e","url":"https://api.github.com/users/pyricau","html_url":"https://github.com/pyricau","followers_url":"https://api.github.com/users/pyricau/followers","following_url":"https://api.github.com/users/pyricau/following{/other_user}","gists_url":"https://api.github.com/users/pyricau/gists{/gist_id}","starred_url":"https://api.github.com/users/pyricau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyricau/subscriptions","organizations_url":"https://api.github.com/users/pyricau/orgs","repos_url":"https://api.github.com/users/pyricau/repos","events_url":"https://api.github.com/users/pyricau/events{/privacy}","received_events_url":"https://api.github.com/users/pyricau/received_events","type":"User","site_admin":false},"body":"I... didn't think of that. Damn.","created_at":"2014-03-31T16:00:33Z","updated_at":"2014-03-31T16:00:33Z","html_url":"https://github.com/square/mortar/pull/64#discussion_r11122362","pull_request_url":"https://api.github.com/repos/square/mortar/pulls/64","_links":{"self":{"href":"https://api.github.com/repos/square/mortar/pulls/comments/11122362"},"html":{"href":"https://github.com/square/mortar/pull/64#discussion_r11122362"},"pull_request":{"href":"https://api.github.com/repos/square/mortar/pulls/64"}}}}