Fix UI bugs

This commit is contained in:
topjohnwu 2016-12-30 04:03:38 +08:00
parent b064c124e7
commit 94562cb5cf
4 changed files with 22 additions and 12 deletions

View File

@ -60,6 +60,18 @@ public class ModulesFragment extends Fragment implements CallbackHandler.EventLi
new Async.LoadModules().exec();
});
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
mSwipeRefreshLayout.setEnabled(recyclerView.getChildAt(0).getTop() >= 0);
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
});
if (moduleLoadDone.isTriggered) {
updateUI();
}

View File

@ -25,7 +25,6 @@ import butterknife.ButterKnife;
public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHolder> {
private final List<Module> mList;
private View mView;
private Context context;
public ModulesAdapter(List<Module> list) {
@ -34,10 +33,10 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
mView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_module, parent, false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_module, parent, false);
context = parent.getContext();
ButterKnife.bind(this, mView);
return new ViewHolder(mView);
ButterKnife.bind(this, view);
return new ViewHolder(view);
}
@Override
@ -70,7 +69,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
protected void onPostExecute(Void v) {
Snackbar.make(mView, R.string.disable_file_removed, Snackbar.LENGTH_SHORT).show();
Snackbar.make(holder.title, R.string.disable_file_removed, Snackbar.LENGTH_SHORT).show();
}
}.exec();
} else {
@ -83,7 +82,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
protected void onPostExecute(Void v) {
Snackbar.make(mView, R.string.disable_file_created, Snackbar.LENGTH_SHORT).show();
Snackbar.make(holder.title, R.string.disable_file_created, Snackbar.LENGTH_SHORT).show();
}
}.exec();
}
@ -100,7 +99,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
protected void onPostExecute(Void v) {
Snackbar.make(mView, R.string.remove_file_deleted, Snackbar.LENGTH_SHORT).show();
Snackbar.make(holder.title, R.string.remove_file_deleted, Snackbar.LENGTH_SHORT).show();
updateDeleteButton(holder, module);
}
}.exec();
@ -114,7 +113,7 @@ public class ModulesAdapter extends RecyclerView.Adapter<ModulesAdapter.ViewHold
@Override
protected void onPostExecute(Void v) {
Snackbar.make(mView, R.string.remove_file_created, Snackbar.LENGTH_SHORT).show();
Snackbar.make(holder.title, R.string.remove_file_created, Snackbar.LENGTH_SHORT).show();
updateDeleteButton(holder, module);
}
}.exec();

View File

@ -42,10 +42,10 @@
<com.github.clans.fab.FloatingActionMenu
android:id="@+id/fabmenu"
android:layout_width="wrap_content"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginRight="120dp"
android:layout_marginEnd="115dp"
android:layout_marginBottom="10dp"
app:layout_behavior=".FABBehavior"
fab:menu_fab_size="normal"
@ -74,5 +74,4 @@
</android.support.design.widget.CoordinatorLayout>
</android.support.v4.widget.SwipeRefreshLayout>

View File

@ -85,7 +85,7 @@
<string name="no_thanks">No thanks</string>
<string name="repo_install_title">Install %1$s</string>
<string name="repo_install_msg">Do you want to install %1$s ?</string>
<string name="download_install">Download and install</string>
<string name="download_install">Download &amp; install</string>
<string name="goto_install">Go to \"Install\" section</string>
<string name="download_file_error">Error downloading file</string>
<string name="install_error">Installation error!</string>