Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
HuXiaobai committed Dec 13, 2018
1 parent a510858 commit 12b6f22
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
11 changes: 8 additions & 3 deletions media/src/main/java/com/example/media/activity/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ public abstract class BaseActivity extends PermissionActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
initInflate();
setContentView(getLayoutId());
initPermission();

}

protected void initInflate() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}


protected void initPermission() {
ActivityManger.get().addActivity(this);
initView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.ViewPager;
Expand All @@ -14,6 +15,7 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.LinearInterpolator;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -67,6 +69,7 @@ protected int getThemeColor() {

@Override
protected void initView() {

mVpPreview = findViewById(R.id.vp_preview);
ViewGroup.LayoutParams layoutParams = mVpPreview.getLayoutParams();
layoutParams.width = ScreenUtils.screenWidth(this);
Expand All @@ -79,6 +82,12 @@ protected void initView() {
mLlBottom = findViewById(R.id.ll_bottom);
}

@Override
protected void initInflate() {
super.initInflate();
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}

@Override
protected void initData() {
Intent intent = getIntent();
Expand Down Expand Up @@ -224,6 +233,28 @@ public void onSureClick(@NonNull View view) {

}
});
mTvTop.setOnBackViewClickListener(new TitleView.OnBackViewClickListener() {
@Override
public void onBackClick(@NonNull View view) {
finish();
}
});
}

@Override
protected void onPause() {
super.onPause();
if (mAnimatorSet != null && mAnimatorSet.isRunning() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mAnimatorSet.pause();
}
}

@Override
protected void onStop() {
super.onStop();
if (mAnimatorSet != null) {
mAnimatorSet.end();
}
}

private void sureData() {
Expand Down
4 changes: 3 additions & 1 deletion media/src/main/res/layout/activity_media.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="true">

<com.example.item.weight.TitleView
android:id="@+id/ctv_top"
Expand Down
3 changes: 2 additions & 1 deletion media/src/main/res/layout/activity_preview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
>
android:clipToPadding="true"
android:fitsSystemWindows="true">

<com.example.media.weight.PreviewViewPager
android:id="@+id/vp_preview"
Expand Down

0 comments on commit 12b6f22

Please sign in to comment.