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