From 1eef930dbb05e0a0b7bec2e36cd0aca657f91ad2 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 8 Aug 2017 16:09:45 +0800 Subject: [PATCH] Move OnClickListener to Butterknife --- .../com/topjohnwu/magisk/ModulesFragment.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java b/app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java index fc0879a14..0df668a20 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java +++ b/app/src/main/java/com/topjohnwu/magisk/ModulesFragment.java @@ -4,7 +4,6 @@ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; -import android.support.design.widget.FloatingActionButton; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; @@ -24,6 +23,7 @@ import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; +import butterknife.OnClick; import butterknife.Unbinder; public class ModulesFragment extends Fragment implements Topic.Subscriber { @@ -34,7 +34,12 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber { @BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout; @BindView(R.id.recyclerView) RecyclerView recyclerView; @BindView(R.id.empty_rv) TextView emptyRv; - @BindView(R.id.fab) FloatingActionButton fabio; + @OnClick(R.id.fab) + public void selectFile() { + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType("application/zip"); + startActivityForResult(intent, FETCH_ZIP_CODE); + } private List listModules = new ArrayList<>(); @@ -44,12 +49,6 @@ public class ModulesFragment extends Fragment implements Topic.Subscriber { View view = inflater.inflate(R.layout.fragment_modules, container, false); unbinder = ButterKnife.bind(this, view); - fabio.setOnClickListener(v -> { - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.setType("application/zip"); - startActivityForResult(intent, FETCH_ZIP_CODE); - }); - mSwipeRefreshLayout.setOnRefreshListener(() -> { recyclerView.setVisibility(View.GONE); new LoadModules(getActivity()).exec();