Skip to content

Commit

Permalink
2018-01-06 加载动画
Browse files Browse the repository at this point in the history
  • Loading branch information
tmwuzhen committed Jan 6, 2018
1 parent 50a0dfa commit 3ad9ab2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
import com.komoriwu.one.model.bean.TagsDetailBean;
import com.komoriwu.one.utils.Constants;
import com.komoriwu.one.utils.Utils;
import com.komoriwu.one.widget.BallPulseView;
import com.komoriwu.one.widget.FZTextView;
import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItemAdapter;
import com.ogaclejapan.smarttablayout.utils.v4.FragmentPagerItems;

import butterknife.BindView;

public abstract class DetailBaseActivity<T extends BasePresenter> extends MvpBaseActivity<T>
implements DetailBaseContract.View {
public static final String TAG = DetailBaseActivity.class.getSimpleName();
Expand All @@ -33,8 +36,8 @@ public abstract class DetailBaseActivity<T extends BasePresenter> extends MvpBas
public FZTextView tvName;
public FZTextView tvDescription;
public AppBarLayout appBar;
public BallPulseView ballPulseView;
private AppBarState mState;

public abstract FragmentPagerItems getPages();

public abstract void loadCategoriesDetail(String id);
Expand All @@ -61,7 +64,7 @@ public void init() {
tvName = findViewById(R.id.tv_name);
tvDescription = findViewById(R.id.tv_description);
appBar = findViewById(R.id.app_bar);

ballPulseView=findViewById(R.id.ball_pulse_view);
initToolB();
initTab();
initListener();
Expand Down Expand Up @@ -122,12 +125,12 @@ public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {

@Override
public void showProgress() {

ballPulseView.startAnim();
}

@Override
public void hideProgress() {

ballPulseView.setVisibility(View.GONE);
}

@Override
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/com/komoriwu/one/me/MeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.komoriwu.one.me.mvp.MeContract;
import com.komoriwu.one.me.mvp.MePresenter;
import com.komoriwu.one.utils.HtmlUtil;
import com.komoriwu.one.widget.BallPulseView;
import com.komoriwu.one.widget.HpTextView;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebView;
Expand All @@ -36,6 +37,8 @@ public class MeFragment extends MvpBaseFragment<MePresenter> implements MeContra
HpTextView tvHpTitle;
@BindView(R.id.web_view)
WebView webView;
@BindView(R.id.ball_pulse_view)
BallPulseView ballPulseView;

@Override
protected void setInject() {
Expand All @@ -52,7 +55,7 @@ public void init() {
tvHpTitle.setVisibility(View.VISIBLE);
tvHpTitle.setText(R.string.me);
initWebView();
showProgressDialog(R.string.loading);
ballPulseView.startAnim();
webView.loadUrl("https://github.com/KomoriWu");
}

Expand All @@ -77,7 +80,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
@Override
public void onPageFinished(WebView webView, String s) {
super.onPageFinished(webView, s);
hideProgressDialog();
ballPulseView.setVisibility(View.GONE);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_categories_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<include layout="@layout/ball_pulse_view" />
</android.support.design.widget.CoordinatorLayout>
8 changes: 8 additions & 0 deletions app/src/main/res/layout/ball_pulse_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<com.komoriwu.one.widget.BallPulseView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ball_pulse_view"
android:layout_width="@dimen/dp_46_x"
android:layout_height="@dimen/dp_46_x"
android:layout_centerInParent="true"
android:layout_gravity="center" />

1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_me.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
android:layout_marginBottom="@dimen/dp_50_y"
android:background="@android:color/white" />

<include layout="@layout/ball_pulse_view" />
</RelativeLayout>

0 comments on commit 3ad9ab2

Please sign in to comment.