连接规则记录操作接口完成
This commit is contained in:
parent
9ff8b1ed80
commit
bd4ba7b291
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Wed Mar 05 08:27:53 GMT 2025
|
||||
#Wed Mar 05 09:18:14 GMT 2025
|
||||
stageCount=9
|
||||
libraryProject=
|
||||
baseVersion=1.0
|
||||
publishVersion=1.0.8
|
||||
buildCount=112
|
||||
buildCount=124
|
||||
baseBetaVersion=1.0.9
|
||||
|
@ -233,6 +233,12 @@ public class SettingsActivity extends AppCompatActivity implements IWinBollActiv
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void onAddNewConnectionRule(View view) {
|
||||
Rules.getInstance(this).getPhoneBlacRuleBeanList().add(new PhoneConnectRuleModel());
|
||||
Rules.getInstance(this).saveRules();
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void onDefaultPhone(View view) {
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
|
||||
startActivity(intent);
|
||||
|
@ -59,23 +59,28 @@ public class PhoneConnectRuleAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
final PhoneConnectRuleModel model = ruleList.get(position);
|
||||
if (holder instanceof SimpleViewHolder) {
|
||||
final SimpleViewHolder simpleViewHolder = (SimpleViewHolder) holder;
|
||||
simpleViewHolder.tvRuleText.setText(model.getRuleText());
|
||||
// simpleViewHolder.setOnActionListener(new SimpleViewHolder.OnActionListener(){
|
||||
//
|
||||
// @Override
|
||||
// public void onEdit(int position) {
|
||||
// model.setIsSimpleView(false);
|
||||
String szView = model.getRuleText().trim().equals("")?"[NULL]":model.getRuleText();
|
||||
simpleViewHolder.tvRuleText.setText(szView);
|
||||
simpleViewHolder.scrollView.setOnActionListener(new LeftScrollView.OnActionListener(){
|
||||
@Override
|
||||
public void onEdit() {
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
model.setIsSimpleView(false);
|
||||
notifyDataSetChanged();
|
||||
//notifyItemChanged(position);
|
||||
// }
|
||||
// @Override
|
||||
// public void onDelete(int position) {
|
||||
// model.setIsSimpleView(false);
|
||||
// ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||
// list.remove(position);
|
||||
// Rules.getInstance(context).saveRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDelete() {
|
||||
simpleViewHolder.scrollView.smoothScrollTo(0, 0);
|
||||
model.setIsSimpleView(true);
|
||||
ArrayList<PhoneConnectRuleModel> list = Rules.getInstance(context).getPhoneBlacRuleBeanList();
|
||||
list.remove(position);
|
||||
Rules.getInstance(context).saveRules();
|
||||
notifyDataSetChanged();
|
||||
//notifyItemChanged(position);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
});
|
||||
// simpleViewHolder.editButton.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
|
@ -109,16 +109,40 @@ public class LeftScrollView extends HorizontalScrollView {
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
LogUtils.d(TAG, "ACTION_UP");
|
||||
if (isScrolling) {
|
||||
LogUtils.d(TAG, String.format("isScrolling \ngetScrollX() %d\neditButton.getWidth() %d", getScrollX(), editButton.getWidth()));
|
||||
int scrollX = getScrollX();
|
||||
if (scrollX > editButton.getWidth()) {
|
||||
smoothScrollTo(getChildAt(0).getWidth(), 0);
|
||||
LogUtils.d(TAG, ">>>>>");
|
||||
// 获取HorizontalScrollView的子视图
|
||||
View childView = getChildAt(0);
|
||||
if (childView != null) {
|
||||
// 计算需要滑动到最右边的距离
|
||||
int scrollToX = childView.getWidth() - getWidth();
|
||||
// 确保滑动距离不小于0
|
||||
final int scrollToX2 = Math.max(0, scrollToX);
|
||||
// 平滑滑动到最右边
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
smoothScrollTo(scrollToX2, 0);
|
||||
LogUtils.d(TAG, "smoothScrollTo(0, 0);");
|
||||
}
|
||||
});
|
||||
LogUtils.d(TAG, "smoothScrollTo(scrollToX, 0);");
|
||||
}
|
||||
} else {
|
||||
// 恢复原状
|
||||
// 在手指抬起时,使用 post 方法调用 smoothScrollTo(0, 0)
|
||||
post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
smoothScrollTo(0, 0);
|
||||
LogUtils.d(TAG, "<<<<<");
|
||||
LogUtils.d(TAG, "smoothScrollTo(0, 0);");
|
||||
}
|
||||
});
|
||||
//toolLayout.setTranslationX(0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -237,15 +237,29 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Phone Connect Rule :"
|
||||
android:layout_weight="1.0"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Phone Connect Rule :"/>
|
||||
android:text="添加新规则"
|
||||
android:onClick="onAddNewConnectionRule"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="400dp"
|
||||
android:layout_height="300dp"
|
||||
android:background="@drawable/recycler_view_border"
|
||||
android:layout_margin="5dp"/>
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:padding="2dp">
|
||||
|
||||
<cc.winboll.studio.contacts.views.LeftScrollView
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user