-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
654 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
androidlib/src/main/java/com/kayoxu/androidlib/dialog/common/IBottomSheetDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package com.kayoxu.androidlib.dialog.common; | ||
|
||
import android.app.SearchManager; | ||
import android.content.Context; | ||
import android.view.View; | ||
import android.widget.FrameLayout; | ||
|
||
import androidx.annotation.NonNull; | ||
import com.bigkoo.pickerview.R; | ||
import com.google.android.material.bottomsheet.BottomSheetBehavior; | ||
import com.google.android.material.bottomsheet.BottomSheetDialog; | ||
|
||
|
||
/** | ||
* TFBlueAndroidXNew | ||
* com.kayoxu.commonlib.widget | ||
* <p> | ||
* Created by kayoxu on 2019-08-19 20:16. | ||
* Copyright © 2019 kayoxu. All rights reserved. | ||
*/ | ||
public class IBottomSheetDialog extends BottomSheetDialog { | ||
int peekHeight = 0; | ||
private BottomSheetBehavior behavior; | ||
|
||
public IBottomSheetDialog(@NonNull Context context) { | ||
super(context); | ||
} | ||
|
||
public IBottomSheetDialog(@NonNull Context context, int theme) { | ||
super(context, theme); | ||
} | ||
|
||
public IBottomSheetDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) { | ||
super(context, cancelable, cancelListener); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
|
||
} | ||
|
||
@Override | ||
public void show() { | ||
super.show(); | ||
if (peekHeight == 0) { | ||
View container = findViewById(R.id.content_layout); | ||
|
||
if (null != container) { | ||
container.measure(0, 0); | ||
peekHeight = container.getMeasuredHeight(); | ||
} | ||
// FrameLayout bottomSheet = (FrameLayout) findViewById(R.id.design_bottom_sheet); | ||
if (null != getBehavior()) { | ||
behavior.setPeekHeight(peekHeight); | ||
} | ||
} | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public BottomSheetBehavior getBehavior() { | ||
if (null == behavior) { | ||
FrameLayout bottomSheet = (FrameLayout) findViewById(R.id.design_bottom_sheet); | ||
if (null != bottomSheet) { | ||
behavior = BottomSheetBehavior.from(bottomSheet); | ||
} | ||
} | ||
|
||
return behavior; | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
androidlib/src/main/java/com/kayoxu/androidlib/dialog/common/INumberPicker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package com.kayoxu.androidlib.dialog.common; | ||
|
||
import android.content.Context; | ||
import android.content.res.Resources; | ||
import android.graphics.Color; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.EditText; | ||
import android.widget.LinearLayout; | ||
import android.widget.NumberPicker; | ||
|
||
import java.lang.reflect.Field; | ||
|
||
|
||
|
||
public class INumberPicker extends NumberPicker { | ||
|
||
Context context; | ||
|
||
public INumberPicker(Context context) { | ||
super(context); | ||
this.context = context; | ||
} | ||
|
||
public INumberPicker(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
this.context = context; | ||
} | ||
|
||
public INumberPicker(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
this.context = context; | ||
} | ||
|
||
|
||
@Override | ||
public void addView(View child) { | ||
super.addView(child); | ||
updateView(child); | ||
} | ||
|
||
@Override | ||
public void addView(View child, int width, int height) { | ||
super.addView(child, width, height); | ||
updateView(child); | ||
} | ||
|
||
@Override | ||
public void addView(View child, int index, ViewGroup.LayoutParams params) { | ||
super.addView(child, index, params); | ||
updateView(child); | ||
} | ||
|
||
@Override | ||
public void addView(View child, ViewGroup.LayoutParams params) { | ||
super.addView(child, params); | ||
updateView(child); | ||
} | ||
|
||
public void updateView(View view) { | ||
setDatePickerDividerColor(this); | ||
setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS); | ||
|
||
if (view instanceof EditText) { | ||
//这里修改显示字体的属性,主要修改颜色和大小 | ||
// ((EditText) view).setTextColor(Color.parseColor("#FF0000")); | ||
// ((EditText) view).setTextSize(14); | ||
} | ||
} | ||
|
||
private void setDatePickerDividerColor(NumberPicker picker) { | ||
Field[] pickerFields = NumberPicker.class.getDeclaredFields(); | ||
for (Field pf : pickerFields) { | ||
if (pf.getName().equals("mSelectionDivider")) { | ||
pf.setAccessible(true); | ||
try { | ||
//设置分割线的颜色值 | ||
pf.set(picker, new ColorDrawable(Color.parseColor("#B8B8B8"))); | ||
} catch (IllegalArgumentException | Resources.NotFoundException | IllegalAccessException e) { | ||
e.printStackTrace(); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
// 分割线高度 | ||
for (Field pf : pickerFields) { | ||
if (pf.getName().equals("mSelectionDividerHeight")) { | ||
pf.setAccessible(true); | ||
try { | ||
// int result = dp2px(context, 1); | ||
int result = 3; | ||
pf.set(picker, result); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
public int dp2px(Context context, float dpValue) { | ||
float scale = context.getResources().getDisplayMetrics().density; | ||
return (int) (dpValue * scale + 0.5f); | ||
} | ||
|
||
} | ||
|
4 changes: 4 additions & 0 deletions
4
androidlib/src/main/java/com/kayoxu/androidlib/dialog/ddd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.kayoxu.androidlib.dialog; | ||
|
||
public class ddd { | ||
} |
Oops, something went wrong.