package com.joker.api.wrapper;

import android.app.Activity;

import com.joker.api.Permissions4M;

/**
 * Created by joker on 2017/8/5.
 */

public interface Wrapper extends ListenerWrapper, AnnotationWrapper {
    /**
     * get activity
     *
     * @return
     */
    Activity getActivity();

    /**
     * request code
     *
     * @param code
     * @return
     */
    Wrapper requestCode(int code);

    /**
     * request permission
     *
     * @param permission {@link android.Manifest.permission}
     * @return
     */
    Wrapper requestPermission(String permission);

    /**
     * android setting page or phone manager page
     *
     * @param pageType {@link Permissions4M.PageType}
     * @return
     */
    Wrapper requestPageType(@Permissions4M.PageType int pageType);

    /**
     * whether should apply permission force
     *
     * @param force true if force
     * @return
     */
    Wrapper requestForce(boolean force);

    /**
     * called when use custom rationale, in case fall in to drop-dead
     * <p>
     * custom rationale -> ensure button -> Permissions4M.request ->
     * if(custom rationale) -> custom rationale
     *
     * @return
     */
    Wrapper requestOnRationale();

    /**
     * allow the android(under {@link android.os.Build.VERSION_CODES#M}, above
     * {@link android.os.Build.VERSION_CODES#LOLLIPOP}) to request permission
     *
     * @param allow true if allow
     * @return
     */
    Wrapper requestUnderM(boolean allow);

    /**
     * get the context({@link android.app.Activity}, {@link android.app.Fragment},
     * {@link android.support.v4.app.Fragment})
     *
     * @return {@link android.app.Activity} or {@link android.app.Fragment} or
     * {@link android.support.v4.app.Fragment}
     */
    Object getContext();

    /**
     * request permission
     */
    void request();

    /**
     * multiple permission request by sync
     */
    void requestSync();

    int getRequestCode();

    String getPermission();

    boolean isRequestOnRationale();

    boolean isRequestUnderM();

    @Permissions4M.PageType
    int getPageType();

    boolean isRequestForce();
}

@@ -395,12 +395,16 @@
 Code
+s
 (int
+...
  cod
@@ -566,15 +566,19 @@
 sion
+s
 (String
+...
  per
@@ -1956,24 +1956,26 @@
 ();%0A%0A    int
+%5B%5D
  getRequestC
@@ -1977,16 +1977,17 @@
 uestCode
+s
 ();%0A%0A   
@@ -1993,20 +1993,29 @@
   String
+%5B%5D
  get
+Request
 Permissi
@@ -2016,16 +2016,17 @@
 rmission
+s
 ();%0A%0A   

refactor code