[
  {
    "path": ".gitignore",
    "content": "*.iml\n.gradle\n/local.properties\n.idea\n\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n"
  },
  {
    "path": "LICENSE",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"{}\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright {yyyy} {name of copyright owner}\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "# FitPopupWindow\n根据点击位置自适应弹出位置的PopupWindow,仿网易新闻/今日头条,\"不感兴趣\"弹框\n\n## 效果图\n![PopupWindow](/popupwindow.gif)\n\n## 用法\n\n\n\t/**\n\t * @param anchorView 目标view\n\t * \n\t */\t\n\tprivate void initPopup(View anchorView) {\n        FitPopupUtil fitPopupUtil = new FitPopupUtil(this);\n        fitPopupUtil.setOnClickListener(new FitPopupUtil.OnCommitClickListener() {\n            @Override\n            public void onClick(String reason) {\n                Toast.makeText(MainActivity.this,reason,Toast.LENGTH_SHORT).show();\n            }\n        });\n        fitPopupUtil.showPopup(anchorView);\n    }\n"
  },
  {
    "path": "app/.gitignore",
    "content": "/build\n"
  },
  {
    "path": "app/build.gradle",
    "content": "apply plugin: 'com.android.application'\n\nandroid {\n    compileSdkVersion 23\n    buildToolsVersion '24.0.1'\n    defaultConfig {\n        applicationId \"com.djr.fitpopupwindow\"\n        minSdkVersion 14\n        targetSdkVersion 23\n        versionCode 1\n        versionName \"1.0\"\n        testInstrumentationRunner \"android.support.test.runner.AndroidJUnitRunner\"\n    }\n    buildTypes {\n        release {\n            minifyEnabled false\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n    }\n}\n\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {\n        exclude group: 'com.android.support', module: 'support-annotations'\n    })\n    compile 'com.android.support:appcompat-v7:23.+'\n    compile 'com.android.support:recyclerview-v7:23.4.0'\n    testCompile 'junit:junit:4.12'\n}\n"
  },
  {
    "path": "app/proguard-rules.pro",
    "content": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in E:\\Android\\Android-Sdk/tools/proguard/proguard-android.txt\n# You can edit the include path and order by changing the proguardFiles\n# directive in build.gradle.\n#\n# For more details, see\n#   http://developer.android.com/guide/developing/tools/proguard.html\n\n# Add any project specific keep options here:\n\n# If your project uses WebView with JS, uncomment the following\n# and specify the fully qualified class name to the JavaScript interface\n# class:\n#-keepclassmembers class fqcn.of.javascript.interface.for.webview {\n#   public *;\n#}\n"
  },
  {
    "path": "app/src/androidTest/java/com/djr/fitpopupwindow/ExampleInstrumentedTest.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport android.content.Context;\nimport android.support.test.InstrumentationRegistry;\nimport android.support.test.runner.AndroidJUnit4;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.*;\n\n/**\n * Instrumentation test, which will execute on an Android device.\n *\n * @see <a href=\"http://d.android.com/tools/testing\">Testing documentation</a>\n */\n@RunWith(AndroidJUnit4.class)\npublic class ExampleInstrumentedTest {\n    @Test\n    public void useAppContext() throws Exception {\n        // Context of the app under test.\n        Context appContext = InstrumentationRegistry.getTargetContext();\n\n        assertEquals(\"com.djr.fitpopupwindow\", appContext.getPackageName());\n    }\n}\n"
  },
  {
    "path": "app/src/main/AndroidManifest.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n          package=\"com.djr.fitpopupwindow\">\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n        </activity>\n        <activity android:name=\".SecondActivity\">\n        </activity>\n    </application>\n\n</manifest>"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/ListAdapter.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport android.app.Activity;\nimport android.content.Context;\nimport android.support.v7.widget.RecyclerView;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.Toast;\n\nimport com.djr.fitpopupwindow.utils.FitPopupUtil;\n\nimport java.util.List;\n\n/**\n * Created by DongJr on 2017/2/21.\n */\n\npublic class ListAdapter extends RecyclerView.Adapter<ListHolder> {\n\n    private List<String> mList;\n    private Context mContext;\n\n    public ListAdapter(Context context, List<String> list) {\n        mContext = context;\n        mList = list;\n    }\n\n\n    @Override\n    public ListHolder onCreateViewHolder(ViewGroup parent, int viewType) {\n        View view = LayoutInflater.from(mContext)\n                .inflate(R.layout.item_list, parent, false);\n        return new ListHolder(view);\n    }\n\n    @Override\n    public void onBindViewHolder(ListHolder holder, int position) {\n\n        holder.ivRemove.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                FitPopupUtil fitPopupUtil = new FitPopupUtil((Activity) mContext);\n                fitPopupUtil.setOnClickListener(new FitPopupUtil.OnCommitClickListener() {\n                    @Override\n                    public void onClick(String reason) {\n                        Toast.makeText(mContext,reason,Toast.LENGTH_SHORT).show();\n                    }\n                });\n                fitPopupUtil.showPopup(v);\n            }\n        });\n    }\n\n    @Override\n    public int getItemCount() {\n        return mList.size();\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/ListHolder.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport android.support.v7.widget.RecyclerView;\nimport android.view.View;\nimport android.widget.ImageView;\n\n\n/**\n * Created by DongJr on 2017/2/21.\n */\n\npublic class ListHolder extends RecyclerView.ViewHolder {\n\n    ImageView ivRemove;\n\n    public ListHolder(View itemView) {\n        super(itemView);\n        ivRemove = (ImageView) itemView.findViewById(R.id.iv_remove);\n    }\n\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/MainActivity.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.widget.Button;\nimport android.widget.Toast;\n\nimport com.djr.fitpopupwindow.utils.FitPopupUtil;\n\npublic class MainActivity extends AppCompatActivity implements View.OnClickListener {\n\n    private LayoutInflater mInflater;\n\n    private Button button1;\n    private Button button2;\n    private Button button3;\n    private Button button4;\n    private Button button5;\n    private Button button6;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        mInflater = LayoutInflater.from(this);\n\n        button1 = (Button) findViewById(R.id.button1);\n        button2 = (Button) findViewById(R.id.button2);\n        button3 = (Button) findViewById(R.id.button3);\n        button4 = (Button) findViewById(R.id.button4);\n        button5 = (Button) findViewById(R.id.button5);\n        button6 = (Button) findViewById(R.id.button6);\n\n        button1.setOnClickListener(this);\n        button2.setOnClickListener(this);\n        button3.setOnClickListener(this);\n        button4.setOnClickListener(this);\n        button5.setOnClickListener(this);\n        button6.setOnClickListener(this);\n    }\n\n\n    private void initPopup(View anchorView) {\n        FitPopupUtil fitPopupUtil = new FitPopupUtil(this);\n        fitPopupUtil.setOnClickListener(new FitPopupUtil.OnCommitClickListener() {\n            @Override\n            public void onClick(String reason) {\n                Toast.makeText(MainActivity.this,reason,Toast.LENGTH_SHORT).show();\n            }\n        });\n        fitPopupUtil.showPopup(anchorView);\n    }\n\n\n    @Override\n    public void onClick(View v) {\n        switch (v.getId()) {\n            case R.id.button1:\n                initPopup(button1);\n                break;\n            case R.id.button2:\n                initPopup(button2);\n                break;\n            case R.id.button3:\n                SecondActivity.startActivity(this);\n                break;\n            case R.id.button4:\n                initPopup(button4);\n                break;\n            case R.id.button5:\n                initPopup(button5);\n                break;\n            case R.id.button6:\n                initPopup(button6);\n            default:\n                break;\n        }\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/SecondActivity.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport android.content.Context;\nimport android.content.Intent;\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.support.v7.widget.LinearLayoutManager;\nimport android.support.v7.widget.RecyclerView;\n\nimport java.util.ArrayList;\n\npublic class SecondActivity extends AppCompatActivity {\n\n    private RecyclerView mRecyclerView;\n\n    public static void startActivity(Context context) {\n        Intent intent = new Intent(context, SecondActivity.class);\n        context.startActivity(intent);\n    }\n\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_second);\n\n        mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);\n\n        init();\n    }\n\n    private void init() {\n\n        ArrayList<String> list = new ArrayList<>();\n        for (int i = 0; i < 20; i++) {\n            list.add(i + \"\");\n        }\n\n        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);\n        mRecyclerView.setLayoutManager(linearLayoutManager);\n\n        ListAdapter listAdapter = new ListAdapter(this, list);\n\n        mRecyclerView.setAdapter(listAdapter);\n    }\n\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/utils/DensityUtils.java",
    "content": "package com.djr.fitpopupwindow.utils;\n\nimport android.content.res.Resources;\n\n/**\n * 单位换算工具类\n */\npublic final class DensityUtils {\n\n    private DensityUtils() {\n        /** cannot be instantiated **/\n        throw new UnsupportedOperationException(\"cannot be instantiated\");\n    }\n\n    /**\n     * dp转px\n     */\n    public static int dp2px(float dpVal) {\n        final float scale = Resources.getSystem().getDisplayMetrics().density;\n        return (int) (dpVal * scale + 0.5f);\n    }\n\n    /**\n     * sp转px\n     */\n    public static int sp2px(float spVal) {\n        final float fontScale = Resources.getSystem().getDisplayMetrics().scaledDensity;\n        return (int) (spVal * fontScale + 0.5f);\n    }\n\n    /**\n     * px转dp\n     */\n    public static float px2dp(float pxVal) {\n        final float scale = Resources.getSystem().getDisplayMetrics().density;\n        return (pxVal / scale);\n    }\n\n    /**\n     * px转sp\n     */\n    public static float px2sp(float pxVal) {\n        return (pxVal / Resources.getSystem().getDisplayMetrics().scaledDensity);\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/utils/FitPopupUtil.java",
    "content": "package com.djr.fitpopupwindow.utils;\n\nimport android.app.Activity;\nimport android.view.LayoutInflater;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.widget.TextView;\n\nimport com.djr.fitpopupwindow.R;\n\n\n/**\n * Created by DongJr on 2017/2/27.\n */\n\npublic class FitPopupUtil implements View.OnClickListener {\n\n    private View contentView;\n\n    private Activity context;\n\n    private TextView reason1;\n    private TextView reason2;\n    private TextView reason3;\n\n    private TextView btnCommit;\n\n    private boolean reason1Selected;\n    private boolean reason2Selected;\n    private boolean reason3Selected;\n\n    private FitPopupWindow mPopupWindow;\n\n    private OnCommitClickListener listener;\n\n    public FitPopupUtil(Activity context) {\n\n        this.context = context;\n\n        LayoutInflater inflater = LayoutInflater.from(context);\n        contentView = inflater.inflate(R.layout.layout_popupwindow, null);\n        reason1 = (TextView) contentView.findViewById(R.id.tv_reason1);\n        reason2 = (TextView) contentView.findViewById(R.id.tv_reason2);\n        reason3 = (TextView) contentView.findViewById(R.id.tv_reason3);\n        btnCommit = (TextView) contentView.findViewById(R.id.btn_commit);\n\n\n        reason1.setOnClickListener(this);\n        reason2.setOnClickListener(this);\n        reason3.setOnClickListener(this);\n\n\n    }\n\n    public void setOnClickListener(OnCommitClickListener listener) {\n        this.listener = listener;\n    }\n\n    /**\n     * 弹出自适应位置的popupwindow\n     *\n     * @param anchorView 目标view\n     */\n    public View showPopup(View anchorView) {\n        if (mPopupWindow == null) {\n            mPopupWindow = new FitPopupWindow(context,\n                    ScreenUtils.getScreenWidth(context) - DensityUtils.dp2px(20),\n                    ViewGroup.LayoutParams.WRAP_CONTENT\n            );\n        }\n\n        mPopupWindow.setView(contentView, anchorView);\n        mPopupWindow.show();\n        return contentView;\n    }\n\n\n    @Override\n    public void onClick(View v) {\n        switch (v.getId()) {\n            case R.id.tv_reason1:\n                reason1Selected = !reason1Selected;\n                reason1.setSelected(reason1Selected);\n                break;\n            case R.id.tv_reason2:\n                reason2Selected = !reason2Selected;\n                reason2.setSelected(reason2Selected);\n                break;\n            case R.id.tv_reason3:\n                reason3Selected = !reason3Selected;\n                reason3.setSelected(reason3Selected);\n                break;\n            case R.id.btn_commit:\n                if (listener != null) {\n                    listener.onClick(getReason());\n                }\n                mPopupWindow.dismiss();\n                break;\n        }\n\n        if (reason1Selected || reason2Selected || reason3Selected) {\n            btnCommit.setOnClickListener(this);\n            btnCommit.setText(\"确定\");\n        } else {\n            btnCommit.setOnClickListener(null);\n            btnCommit.setText(\"不感兴趣\");\n        }\n    }\n\n    public String getReason() {\n        String content1 = reason1Selected ? reason1.getText().toString() + \",\" : \"\";\n        String content2 = reason2Selected ? reason2.getText().toString() + \",\" : \"\";\n        String content3 = reason3Selected ? reason3.getText().toString() + \",\" : \"\";\n\n        String s = content1 + content2 + content3;\n        return s.substring(0, s.length() - 1);\n\n    }\n\n    public interface OnCommitClickListener {\n        void onClick(String reason);\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/utils/FitPopupWindow.java",
    "content": "package com.djr.fitpopupwindow.utils;\n\nimport android.app.Activity;\nimport android.graphics.drawable.ColorDrawable;\nimport android.support.v4.view.animation.FastOutSlowInInterpolator;\nimport android.view.Gravity;\nimport android.view.View;\nimport android.view.ViewGroup;\nimport android.view.Window;\nimport android.view.WindowManager;\nimport android.view.animation.AlphaAnimation;\nimport android.view.animation.Animation;\nimport android.view.animation.AnimationSet;\nimport android.view.animation.ScaleAnimation;\nimport android.widget.PopupWindow;\nimport android.widget.RelativeLayout;\n\nimport com.djr.fitpopupwindow.R;\n\n/**\n * Created by DongJr on 2017/2/21.\n */\n\npublic class FitPopupWindow extends PopupWindow implements PopupWindow.OnDismissListener {\n\n    private View anchorView;\n    private Activity context;\n\n    private int mWindowWidth;\n\n    private static final int PADDING = 0;\n    //x轴坐标\n    private int mXCoordinate;\n\n    private int mHorizontal;\n    private int mVertical;\n    private int[] windowPos;\n    private FitPopupWindowLayout mFitPopupWindowLayout;\n\n    public FitPopupWindow(Activity context) {\n        init(context, ViewGroup.LayoutParams.WRAP_CONTENT\n                , ViewGroup.LayoutParams.WRAP_CONTENT);\n    }\n\n    public FitPopupWindow(Activity context, int width, int height) {\n        mWindowWidth = width;\n        init(context, width, height);\n    }\n\n\n    private void init(Activity context, int width, int height) {\n        this.context = context;\n        //popupwindow会默认忽略最外层的大小,所以应该再嵌套一层\n        setWidth(width);\n        setHeight(height);\n        setBackgroundDrawable(new ColorDrawable(0x00000000));\n        setOutsideTouchable(true);\n        setFocusable(true);\n        setOnDismissListener(this);\n\n        setAnimationStyle(R.style.popp_anim);\n    }\n\n    public void setView(View contentView, View anchorView) {\n        this.anchorView = anchorView;\n        windowPos = calculatePopWindowPos(anchorView, contentView);\n\n        mFitPopupWindowLayout = new FitPopupWindowLayout(context);\n        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(\n                ViewGroup.LayoutParams.MATCH_PARENT, getHeight() - FitPopupWindowLayout.SHARP_HEIGHT);\n        layoutParams.bottomMargin = FitPopupWindowLayout.SHARP_HEIGHT;\n\n        contentView.setLayoutParams(layoutParams);\n        mFitPopupWindowLayout.setOrientation(getHorizontal(), getVertical()\n                , getXCoordinate());\n        mFitPopupWindowLayout.addView(contentView);\n        setContentView(mFitPopupWindowLayout);\n    }\n\n\n    public void show() {\n        showAtLocation(anchorView, Gravity.TOP | Gravity.END\n                , windowPos[0], windowPos[1]);\n        update();\n        Window window = context.getWindow();\n        WindowManager.LayoutParams lp = window.getAttributes();\n        lp.alpha = 0.7f;\n        window.setAttributes(lp);\n\n    }\n\n\n    /**\n     * @param anchorView  弹出window的view\n     * @param contentView window的内容布局\n     * @return window显示的左上角的xOff, yOff坐标\n     */\n    protected int[] calculatePopWindowPos(final View anchorView, final View contentView) {\n        final int windowPos[] = new int[2];\n        final int anchorLoc[] = new int[2];\n        // 获取锚点View在屏幕上的左上角坐标位置\n        anchorView.getLocationOnScreen(anchorLoc);\n        final int anchorHeight = anchorView.getHeight();\n        final int anchorWidth = anchorView.getWidth();\n        mXCoordinate = anchorLoc[0];\n        // 获取屏幕的高宽\n        final int screenHeight = ScreenUtils.getScreenHeight(anchorView.getContext());\n        final int screenWidth = ScreenUtils.getScreenWidth(anchorView.getContext());\n        contentView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);\n        // 计算contentView的高宽\n        int windowHeight = contentView.getMeasuredHeight();\n        mWindowWidth = mWindowWidth > 0 ? mWindowWidth : contentView.getMeasuredWidth();\n\n        // 判断需要向上弹出还是向下弹出,如果要改变弹出策略,改变此处即可\n        // 目前是根据屏幕的一半进行判断\n        final boolean isNeedShowUp = (screenHeight - anchorLoc[1] - anchorHeight < screenHeight / 2);\n\n        // 判断需要向左弹出还是向右弹出\n        final boolean isNeedShowLeft = (anchorLoc[0] < mWindowWidth / 2);\n\n        setHorizontal(isNeedShowLeft ? FitPopupWindowLayout.LEFT : FitPopupWindowLayout.RIGHT);\n        setVertical(isNeedShowUp ? FitPopupWindowLayout.UP : FitPopupWindowLayout.DOWN);\n\n//        windowPos[0] = isNeedShowLeft ?\n//                anchorLoc[0] - windowWidth : anchorLoc[0] + anchorWidth;\n\n        windowPos[0] = (screenWidth - mWindowWidth) / 2;\n\n        windowPos[1] = isNeedShowUp ?\n                anchorLoc[1] - windowHeight - PADDING - FitPopupWindowLayout.SHARP_HEIGHT\n                : anchorLoc[1] + anchorHeight + PADDING;\n\n        return windowPos;\n    }\n\n    @Override\n    public void dismiss() {\n        super.dismiss();\n    }\n\n    @Override\n    public void onDismiss() {\n        WindowManager.LayoutParams lp = context.getWindow().getAttributes();\n        lp.alpha = 1f;\n        context.getWindow().setAttributes(lp);\n\n    }\n\n    public int getXCoordinate() {\n        if (mXCoordinate > mWindowWidth / 2) {\n            mXCoordinate = mWindowWidth - mXCoordinate - anchorView.getWidth() + 50;\n        }\n        return mXCoordinate;\n    }\n\n    private int getHorizontal() {\n        return mHorizontal;\n    }\n\n    /**\n     * @param mHorizontal 设置水平方向\n     */\n    private void setHorizontal(int mHorizontal) {\n        this.mHorizontal = mHorizontal;\n    }\n\n    private int getVertical() {\n        return mVertical;\n    }\n\n    /**\n     * @param mVertical 设置竖直方向\n     */\n    private void setVertical(int mVertical) {\n        this.mVertical = mVertical;\n    }\n\n\n    private void startAnimation(boolean isStart) {\n        AnimationSet animationSet = new AnimationSet(true);\n\n        ScaleAnimation sa;\n        sa = new ScaleAnimation(0, 1f, 0, 1f,\n                Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);\n        sa.setDuration(150);\n        sa.setInterpolator(new FastOutSlowInInterpolator());\n        sa.setFillAfter(true);\n\n        AlphaAnimation aa = new AlphaAnimation(0f, 1f);\n        aa.setDuration(150);\n        aa.setFillAfter(true);\n\n        animationSet.addAnimation(sa);\n        animationSet.addAnimation(aa);\n\n        mFitPopupWindowLayout.startAnimation(animationSet);\n\n    }\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/utils/FitPopupWindowLayout.java",
    "content": "package com.djr.fitpopupwindow.utils;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Color;\nimport android.graphics.Paint;\nimport android.graphics.Path;\nimport android.graphics.RectF;\nimport android.util.AttributeSet;\nimport android.widget.RelativeLayout;\n\n/**\n * Created by DongJr on 2017/2/21.\n * <p>\n * 气泡\n */\n\npublic class FitPopupWindowLayout extends RelativeLayout {\n\n    public static final int UP = 1;\n    public static final int RIGHT = 2;\n    public static final int LEFT = 3;\n    public static final int DOWN = 4;\n\n    private int mHorizontal = LEFT;\n    private int mVertical = DOWN;\n\n\n    private Paint mPaint;\n    public static final int SHARP_WIDTH = 50;\n    public static final int SHARP_HEIGHT = (int) (SHARP_WIDTH * 1.0f);\n    private static final int RECT_CORNER = 20;\n\n    private int mXoffset = 20;\n\n    private Path mPath = new Path();\n    private Path mSharpPath = new Path();\n\n\n    public FitPopupWindowLayout(Context context) {\n        this(context, null);\n    }\n\n    public FitPopupWindowLayout(Context context, AttributeSet attrs) {\n        this(context, attrs, 0);\n    }\n\n    public FitPopupWindowLayout(Context context, AttributeSet attrs, int defStyleAttr) {\n        super(context, attrs, defStyleAttr);\n        setBackgroundColor(Color.TRANSPARENT);\n\n        mPaint = new Paint();\n        mPaint.setColor(Color.WHITE);\n        mPaint.setStyle(Paint.Style.FILL);\n        mPaint.setAntiAlias(true);\n\n    }\n\n\n    private Path makeSharpPath() {\n        mSharpPath.moveTo(mXoffset, getMeasuredHeight() - SHARP_HEIGHT);\n        mSharpPath.cubicTo(mXoffset, getMeasuredHeight(), mXoffset, getMeasuredHeight() - SHARP_HEIGHT,\n                SHARP_WIDTH + mXoffset, getMeasuredHeight() - SHARP_HEIGHT);\n        return mSharpPath;\n    }\n\n\n    @Override\n    protected void onDraw(Canvas canvas) {\n\n        mPath.addRoundRect(new RectF(0, 0, getMeasuredWidth(), getMeasuredHeight() - SHARP_HEIGHT)\n                , RECT_CORNER, RECT_CORNER, Path.Direction.CW);\n        mPath.addPath(makeSharpPath());\n        canvas.drawPath(mPath, mPaint);\n\n        if (mHorizontal == LEFT && mVertical == UP) {\n            setScaleX(1);\n            setScaleY(1);\n        } else if (mHorizontal == LEFT && mVertical == DOWN) {\n            setScaleX(1);\n            setScaleY(-1);\n            scaleChild(1, -1);\n        } else if (mHorizontal == RIGHT && mVertical == UP) {\n            setScaleX(-1);\n            setScaleY(1);\n            scaleChild(-1, 1);\n        } else if (mHorizontal == RIGHT && mVertical == DOWN) {\n            setScaleX(-1);\n            setScaleY(-1);\n            scaleChild(-1, -1);\n        }\n\n    }\n\n    private void scaleChild(float scaleX, float scaleY) {\n        for (int i = 0; i < getChildCount(); i++) {\n            getChildAt(i).setScaleX(scaleX);\n            getChildAt(i).setScaleY(scaleY);\n        }\n    }\n\n    public void setOrientation(int horizontal, int vertical, int xOffset) {\n        mHorizontal = horizontal;\n        mVertical = vertical;\n        mXoffset = xOffset;\n        invalidate();\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/java/com/djr/fitpopupwindow/utils/ScreenUtils.java",
    "content": "package com.djr.fitpopupwindow.utils;\n\nimport android.content.Context;\n\n/**\n * Created by DongJr on 2017/2/21.\n */\n\npublic class ScreenUtils {\n\n    private ScreenUtils() {\n    }\n\n    public static int getScreenHeight(Context context) {\n        return context.getResources().getDisplayMetrics().heightPixels;\n    }\n\n    public static int getScreenWidth(Context context) {\n        return context.getResources().getDisplayMetrics().widthPixels;\n    }\n\n}\n"
  },
  {
    "path": "app/src/main/res/anim/anim_popup_in.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <scale\n        android:duration=\"150\"\n        android:fromXScale=\"0.0\"\n        android:fromYScale=\"0.0\"\n        android:interpolator=\"@android:anim/accelerate_interpolator\"\n        android:pivotX=\"50%\"\n        android:pivotY=\"50%\"\n        android:toXScale=\"1.0\"\n        android:toYScale=\"1.0\"/>\n\n    <alpha\n        android:duration=\"150\"\n        android:fromAlpha=\"0.0\"\n        android:interpolator=\"@android:anim/accelerate_interpolator\"\n        android:toAlpha=\"1.0\"\n        />\n</set>\n"
  },
  {
    "path": "app/src/main/res/anim/anim_popup_out.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <scale\n        android:duration=\"150\"\n        android:fromXScale=\"1.0\"\n        android:fromYScale=\"1.0\"\n        android:interpolator=\"@android:anim/accelerate_interpolator\"\n        android:pivotX=\"50%\"\n        android:pivotY=\"50%\"\n        android:toXScale=\"0.0\"\n        android:toYScale=\"0.0\"/>\n\n\n    <alpha\n        android:duration=\"150\"\n        android:fromAlpha=\"1.0\"\n        android:interpolator=\"@android:anim/accelerate_interpolator\"\n        android:toAlpha=\"0.0\"\n        />\n</set>\n"
  },
  {
    "path": "app/src/main/res/drawable/orange_corners_bg.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <corners android:radius=\"15dp\"/>\n    <solid android:color=\"#ff9900\"/>\n</shape>\n"
  },
  {
    "path": "app/src/main/res/drawable/popupwindow_bg.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\"\n       android:shape=\"rectangle\">\n\n    <corners android:radius=\"10dp\"/>\n    <solid android:color=\"#ffffff\"/>\n\n</shape>\n"
  },
  {
    "path": "app/src/main/res/drawable/selector_popupwindow_text_bg.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:state_pressed=\"true\">\n        <shape android:shape=\"rectangle\">\n            <corners android:radius=\"5dp\"/>\n            <stroke android:width=\"1dp\" android:color=\"@color/c_ff9900\"/>\n\n            <solid android:color=\"@color/c_ff9900\"/>\n        </shape>\n    </item>\n\n    <item android:state_selected=\"true\">\n        <shape android:shape=\"rectangle\">\n            <corners android:radius=\"5dp\"/>\n            <stroke android:width=\"1dp\" android:color=\"@color/c_ff9900\"/>\n\n            <solid android:color=\"@color/c_ff9900\"/>\n        </shape>\n    </item>\n\n    <item>\n        <shape android:shape=\"rectangle\">\n            <corners android:radius=\"5dp\"/>\n            <stroke android:width=\"1dp\" android:color=\"#dddddd\"/>\n            <solid android:color=\"@color/color_transparent\"/>\n        </shape>\n    </item>\n\n\n</selector>\n"
  },
  {
    "path": "app/src/main/res/drawable/selector_popupwindow_text_color.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:color=\"@color/color_white\" android:state_pressed=\"true\">\n    </item>\n    <item android:color=\"@color/color_white\" android:state_selected=\"true\"/>\n    <item android:color=\"@color/c_ff9900\">\n    </item>\n\n\n</selector>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_main.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/activity_main\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    tools:context=\"com.djr.fitpopupwindow.MainActivity\">\n\n    <Button\n        android:id=\"@+id/button1\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentLeft=\"true\"\n        android:text=\"button1\"\n        />\n\n    <Button\n        android:id=\"@+id/button2\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentRight=\"true\"\n        android:layout_alignParentTop=\"true\"\n        android:text=\"button2\"\n        />\n\n    <Button\n        android:id=\"@+id/button4\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentBottom=\"true\"\n        android:text=\"button4\"\n        />\n\n\n    <Button\n        android:id=\"@+id/button5\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_alignParentRight=\"true\"\n        android:text=\"button5\"\n        />\n\n    <Button\n        android:id=\"@+id/button3\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_centerHorizontal=\"true\"\n        android:layout_centerVertical=\"true\"\n        android:text=\"to second\"/>\n\n\n    <Button\n        android:id=\"@+id/button6\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_below=\"@id/button3\"\n        android:layout_centerHorizontal=\"true\"\n        android:layout_centerVertical=\"true\"\n        android:text=\"button5\"/>\n\n</RelativeLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/activity_second.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<FrameLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:id=\"@+id/activity_second\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    tools:context=\"com.djr.fitpopupwindow.SecondActivity\">\n\n\n    <android.support.v7.widget.RecyclerView\n        android:id=\"@+id/recyclerView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"/>\n\n\n</FrameLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/item_list.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"80dp\"\n    android:background=\"@drawable/popupwindow_bg\">\n\n    <TextView\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_gravity=\"center\"\n        android:padding=\"16dp\"\n        android:text=\"@string/popup_text\"\n        android:textColor=\"@color/color_333\"\n        android:textSize=\"@dimen/text_small\" />\n\n    <ImageView\n        android:id=\"@+id/iv_remove\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:layout_alignParentBottom=\"true\"\n        android:layout_alignParentRight=\"true\"\n        android:layout_margin=\"16dp\"\n        android:src=\"@mipmap/ic_close\" />\n\n    <View\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"1dp\"\n        android:layout_alignParentBottom=\"true\"\n        android:background=\"#e0e0e0\" />\n\n</RelativeLayout>\n"
  },
  {
    "path": "app/src/main/res/layout/layout_popupwindow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<LinearLayout\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:layout_centerInParent=\"true\"\n    android:orientation=\"vertical\"\n    >\n    <FrameLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"45dp\"\n        android:orientation=\"horizontal\"\n        >\n        <TextView\n            android:id=\"@+id/textView\"\n            android:layout_width=\"wrap_content\"\n            android:layout_height=\"45dp\"\n            android:gravity=\"center_vertical\"\n            android:paddingBottom=\"8dp\"\n            android:paddingLeft=\"16dp\"\n            android:paddingRight=\"16dp\"\n            android:paddingTop=\"8dp\"\n            android:text=\"可选理由，精准屏蔽\"\n            android:textColor=\"@color/color_333\"\n            android:textSize=\"@dimen/text_small\"/>\n\n\n        <TextView\n            android:id=\"@+id/btn_commit\"\n            android:layout_width=\"88dp\"\n            android:layout_height=\"24dp\"\n            android:gravity=\"center\"\n            android:layout_gravity=\"right|center_vertical\"\n            android:layout_marginRight=\"10dp\"\n            android:background=\"@drawable/orange_corners_bg\"\n            android:text=\"不感兴趣\"\n            android:textColor=\"@color/color_white\"\n            android:textSize=\"@dimen/text_small\"/>\n\n\n    </FrameLayout>\n\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        >\n\n        <TextView\n            android:id=\"@+id/tv_reason1\"\n            style=\"@style/text_popup_not_interest\"\n            android:text=\"重复、旧闻\"\n            />\n\n        <TextView\n            android:id=\"@+id/tv_reason2\"\n            style=\"@style/text_popup_not_interest\"\n            android:text=\"内容质量差\"\n\n            />\n    </LinearLayout>\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        android:paddingBottom=\"12dp\"\n        >\n\n        <TextView\n            android:id=\"@+id/tv_reason3\"\n            style=\"@style/text_popup_not_interest\"\n            android:text=\"来源\"\n            />\n\n        <TextView\n            style=\"@style/text_popup_not_interest\"\n            android:visibility=\"invisible\"\n            android:text=\"来源\"\n            />\n    </LinearLayout>\n</LinearLayout>\n"
  },
  {
    "path": "app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <color name=\"colorPrimary\">#3F51B5</color>\n    <color name=\"colorPrimaryDark\">#303F9F</color>\n    <color name=\"colorAccent\">#FF4081</color>\n\n    <color name=\"color_333\">#333333</color>\n    <color name=\"color_grey\">#33333333</color>\n\n    <color name=\"color_white\">#ffffff</color>\n\n    <color name=\"color_red\">#ff0000</color>\n    <color name=\"color_line\">#e0e0e0</color>\n    <color name=\"color_transparent\">#00000000</color>\n\n    <color name=\"c_ff9900\">#ff9900</color>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/dimens.xml",
    "content": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal_margin\">16dp</dimen>\n    <dimen name=\"activity_vertical_margin\">16dp</dimen>\n\n    <dimen name=\"text_small\">12sp</dimen>\n    <dimen name=\"text_middle\">14sp</dimen>\n    <dimen name=\"text_large\">16sp</dimen>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/strings.xml",
    "content": "<resources>\n    <string name=\"app_name\">FitPopupWindow</string>\n\n    <string name=\"popup_text\">哪里不会点哪里</string>\n\n    <string name=\"not_interest\">不感兴趣</string>\n\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values/styles.xml",
    "content": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n        <!-- Customize your theme here. -->\n        <item name=\"colorPrimary\">@color/colorPrimary</item>\n        <item name=\"colorPrimaryDark\">@color/colorPrimaryDark</item>\n        <item name=\"colorAccent\">@color/colorAccent</item>\n    </style>\n\n    <style name=\"popp_anim\" parent=\"android:Animation\">\n        <item name=\"android:windowEnterAnimation\">@anim/anim_popup_in</item>\n        <item name=\"android:windowExitAnimation\">@anim/anim_popup_out</item>\n    </style>\n\n    <style name=\"text_popup_not_interest\">\n    <item name=\"android:layout_width\">0dp</item>\n    <item name=\"android:layout_height\">wrap_content</item>\n    <item name=\"android:layout_marginBottom\">8dp</item>\n    <item name=\"android:layout_marginLeft\">8dp</item>\n    <item name=\"android:layout_marginRight\">8dp</item>\n    <item name=\"android:layout_weight\">1</item>\n    <item name=\"android:background\">@drawable/selector_popupwindow_text_bg</item>\n    <item name=\"android:clickable\">true</item>\n    <item name=\"android:gravity\">center</item>\n    <item name=\"android:padding\">8dp</item>\n    <item name=\"android:textSize\">@dimen/text_small</item>\n    <item name=\"android:textColor\">@drawable/selector_popupwindow_text_color</item>\n\n</style>\n\n</resources>\n"
  },
  {
    "path": "app/src/main/res/values-w820dp/dimens.xml",
    "content": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as screen margins) for screens with more than 820dp of available width. This\n         would include 7\" and 10\" devices in landscape (~960dp and ~1280dp respectively). -->\n    <dimen name=\"activity_horizontal_margin\">64dp</dimen>\n</resources>\n"
  },
  {
    "path": "app/src/test/java/com/djr/fitpopupwindow/ExampleUnitTest.java",
    "content": "package com.djr.fitpopupwindow;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Example local unit test, which will execute on the development machine (host).\n *\n * @see <a href=\"http://d.android.com/tools/testing\">Testing documentation</a>\n */\npublic class ExampleUnitTest {\n    @Test\n    public void addition_isCorrect() throws Exception {\n        assertEquals(4, 2 + 2);\n    }\n}"
  },
  {
    "path": "build.gradle",
    "content": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:2.2.3'\n\n        // NOTE: Do not place your application dependencies here; they belong\n        // in the individual module build.gradle files\n    }\n}\n\nallprojects {\n    repositories {\n        jcenter()\n    }\n}\n\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "#Mon Dec 28 10:00:20 PST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.14.1-all.zip\n"
  },
  {
    "path": "gradle.properties",
    "content": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will override*\n# any settings specified in this file.\n\n# For more details on how to configure your build environment visit\n# http://www.gradle.org/docs/current/userguide/build_environment.html\n\n# Specifies the JVM arguments used for the daemon process.\n# The setting is particularly useful for tweaking memory settings.\norg.gradle.jvmargs=-Xmx1536m\n\n# When configured, Gradle will run in incubating parallel mode.\n# This option should only be used with decoupled projects. More details, visit\n# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects\n# org.gradle.parallel=true\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "settings.gradle",
    "content": "include ':app'\n"
  }
]