功能优化
This commit is contained in:
parent
bd3121eee1
commit
0c81561074
@ -16,12 +16,35 @@ public class Solution {
|
|||||||
@ColumnInfo(name = "solution_name")
|
@ColumnInfo(name = "solution_name")
|
||||||
public String solutionName;
|
public String solutionName;
|
||||||
|
|
||||||
public Solution(String solutionName) {
|
@ColumnInfo(name = "mode")
|
||||||
|
public int mode;
|
||||||
|
|
||||||
|
public Solution(String solutionName, int mode) {
|
||||||
this.solutionName = solutionName;
|
this.solutionName = solutionName;
|
||||||
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSolutionId() { return solutionId; }
|
public int getMode() {
|
||||||
public void setSolutionId(long solutionId) { this.solutionId = solutionId; }
|
return mode;
|
||||||
public String getSolutionName() { return solutionName; }
|
}
|
||||||
public void setSolutionName(String solutionName) { this.solutionName = solutionName; }
|
|
||||||
|
public void setMode(int mode) {
|
||||||
|
this.mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getSolutionId() {
|
||||||
|
return solutionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSolutionId(long solutionId) {
|
||||||
|
this.solutionId = solutionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSolutionName() {
|
||||||
|
return solutionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSolutionName(String solutionName) {
|
||||||
|
this.solutionName = solutionName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,18 +9,23 @@ import androidx.core.view.ViewCompat;
|
|||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import com.auto.clicker.autoclicker.R;
|
import com.auto.clicker.autoclicker.R;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityBatteryLimitFreeBinding;
|
||||||
|
|
||||||
public class BatteryLimitFreeActivity extends AppCompatActivity {
|
public class BatteryLimitFreeActivity extends AppCompatActivity {
|
||||||
|
private ActivityBatteryLimitFreeBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
EdgeToEdge.enable(this);
|
EdgeToEdge.enable(this);
|
||||||
setContentView(R.layout.activity_battery_limit_free);
|
binding = ActivityBatteryLimitFreeBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,18 +9,24 @@ import androidx.core.view.ViewCompat;
|
|||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import com.auto.clicker.autoclicker.R;
|
import com.auto.clicker.autoclicker.R;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityBatteryLimitFreeBinding;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityFeedbackBinding;
|
||||||
|
|
||||||
public class FeedbackActivity extends AppCompatActivity {
|
public class FeedbackActivity extends AppCompatActivity {
|
||||||
|
private ActivityFeedbackBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
EdgeToEdge.enable(this);
|
EdgeToEdge.enable(this);
|
||||||
setContentView(R.layout.activity_feedback);
|
binding = ActivityFeedbackBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
binding.backArrow.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,6 +34,8 @@ public class HowToUseActivity extends AppCompatActivity {
|
|||||||
initTabs();
|
initTabs();
|
||||||
|
|
||||||
binding.howViewpager.setCurrentItem(0, false);
|
binding.howViewpager.setCurrentItem(0, false);
|
||||||
|
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPagerAdapter() {
|
private void initPagerAdapter() {
|
||||||
|
|||||||
@ -9,18 +9,24 @@ import androidx.core.view.ViewCompat;
|
|||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
|
|
||||||
import com.auto.clicker.autoclicker.R;
|
import com.auto.clicker.autoclicker.R;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityFeedbackBinding;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityScriptsBinding;
|
||||||
|
|
||||||
public class ScriptsActivity extends AppCompatActivity {
|
public class ScriptsActivity extends AppCompatActivity {
|
||||||
|
private ActivityScriptsBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
EdgeToEdge.enable(this);
|
EdgeToEdge.enable(this);
|
||||||
setContentView(R.layout.activity_scripts);
|
binding = ActivityScriptsBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
binding.btnBack.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,18 +8,24 @@ import androidx.core.graphics.Insets;
|
|||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
import androidx.core.view.WindowInsetsCompat;
|
||||||
import com.auto.clicker.autoclicker.R;
|
import com.auto.clicker.autoclicker.R;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityFeedbackBinding;
|
||||||
|
import com.auto.clicker.autoclicker.databinding.ActivityTroubleshootingBinding;
|
||||||
|
|
||||||
public class TroubleshootingActivity extends AppCompatActivity {
|
public class TroubleshootingActivity extends AppCompatActivity {
|
||||||
|
private ActivityTroubleshootingBinding binding;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
EdgeToEdge.enable(this);
|
EdgeToEdge.enable(this);
|
||||||
setContentView(R.layout.activity_troubleshooting);
|
binding = ActivityTroubleshootingBinding.inflate(getLayoutInflater());
|
||||||
|
setContentView(binding.getRoot());
|
||||||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
|
||||||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
||||||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
|
||||||
return insets;
|
return insets;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,6 +34,8 @@ public class SettingActivity extends AppCompatActivity {
|
|||||||
initTabs();
|
initTabs();
|
||||||
|
|
||||||
binding.settingViewpager.setCurrentItem(0, false);
|
binding.settingViewpager.setCurrentItem(0, false);
|
||||||
|
|
||||||
|
binding.back.setOnClickListener(v -> finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPagerAdapter() {
|
private void initPagerAdapter() {
|
||||||
|
|||||||
@ -3,10 +3,12 @@ package com.auto.clicker.autoclicker.ui.adapter.floating;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import com.auto.clicker.autoclicker.R;
|
||||||
import com.auto.clicker.autoclicker.room.entity.Solution;
|
import com.auto.clicker.autoclicker.room.entity.Solution;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -29,7 +31,7 @@ public class SolutionAdapter extends RecyclerView.Adapter<SolutionAdapter.Soluti
|
|||||||
@Override
|
@Override
|
||||||
public SolutionViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public SolutionViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(android.R.layout.simple_list_item_1, parent, false);
|
.inflate(R.layout.item_solution, parent, false);
|
||||||
return new SolutionViewHolder(view);
|
return new SolutionViewHolder(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,12 +39,18 @@ public class SolutionAdapter extends RecyclerView.Adapter<SolutionAdapter.Soluti
|
|||||||
public void onBindViewHolder(@NonNull SolutionViewHolder holder, int position) {
|
public void onBindViewHolder(@NonNull SolutionViewHolder holder, int position) {
|
||||||
Solution solution = solutionList.get(position);
|
Solution solution = solutionList.get(position);
|
||||||
holder.solutionNameTextView.setText(solution.getSolutionName());
|
holder.solutionNameTextView.setText(solution.getSolutionName());
|
||||||
|
if(solution.getMode() == 1){
|
||||||
|
holder.solutionModeNameTextView.setText("1-point Mode");
|
||||||
|
}else {
|
||||||
|
holder.solutionModeNameTextView.setText("Multi-Point Mode");
|
||||||
|
}
|
||||||
|
|
||||||
holder.itemView.setOnClickListener(v -> {
|
holder.solutionPlayImageView.setOnClickListener(v -> {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onSolutionClick(solution);
|
listener.onSolutionClick(solution);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,10 +68,14 @@ public class SolutionAdapter extends RecyclerView.Adapter<SolutionAdapter.Soluti
|
|||||||
|
|
||||||
static class SolutionViewHolder extends RecyclerView.ViewHolder {
|
static class SolutionViewHolder extends RecyclerView.ViewHolder {
|
||||||
TextView solutionNameTextView;
|
TextView solutionNameTextView;
|
||||||
|
TextView solutionModeNameTextView;
|
||||||
|
ImageView solutionPlayImageView;
|
||||||
|
|
||||||
SolutionViewHolder(View itemView) {
|
SolutionViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
solutionNameTextView = itemView.findViewById(android.R.id.text1);
|
solutionNameTextView = itemView.findViewById(R.id.textViewTopLeft);
|
||||||
|
solutionModeNameTextView = itemView.findViewById(R.id.textViewBottomLeft);
|
||||||
|
solutionPlayImageView = itemView.findViewById(R.id.imageViewRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.auto.clicker.autoclicker.ui.fragment.setting;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.InputType;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -10,109 +11,186 @@ import android.widget.PopupWindow;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.auto.clicker.autoclicker.R;
|
import com.auto.clicker.autoclicker.R;
|
||||||
import com.auto.clicker.autoclicker.databinding.FragmentActionBinding;
|
import com.auto.clicker.autoclicker.databinding.FragmentActionBinding;
|
||||||
|
|
||||||
|
|
||||||
public class ActionFragment extends Fragment {
|
public class ActionFragment extends Fragment {
|
||||||
private FragmentActionBinding binding;
|
private FragmentActionBinding binding;
|
||||||
|
|
||||||
|
private static final int TYPE_INTERVAL = 0;
|
||||||
|
private static final int TYPE_SWIPE_DURATION = 1;
|
||||||
|
private static final int TYPE_REPEAT = 2;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
binding = FragmentActionBinding.inflate(inflater, container, false);
|
binding = FragmentActionBinding.inflate(inflater, container, false);
|
||||||
|
|
||||||
binding.intervalSelectorContainer.setOnClickListener(this::showIntervalUnitSelection);
|
binding.intervalSelectorContainer.setOnClickListener(v -> showUnitSelection(v, TYPE_INTERVAL));
|
||||||
|
binding.unitSelectorContainer.setOnClickListener(v -> showUnitSelection(v, TYPE_SWIPE_DURATION));
|
||||||
|
|
||||||
binding.unitSelectorContainer.setOnClickListener(this::showSwipeDurationUnitSelection);
|
setupRepeatMode();
|
||||||
|
|
||||||
|
setupAdvancedMode();
|
||||||
|
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showIntervalUnitSelection(View anchorView) {
|
private void setupRepeatMode() {
|
||||||
// 加载弹窗布局
|
binding.repeatSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
if (isChecked) {
|
||||||
|
binding.repeatInput.setVisibility(View.VISIBLE);
|
||||||
|
binding.repeatSelectorContainer.setVisibility(View.VISIBLE);
|
||||||
|
binding.repeatSelectedUnit.setText(getString(R.string.infinitely_unit));
|
||||||
|
binding.etRepeatValue.setText("");
|
||||||
|
binding.etRepeatValue.setEnabled(false);
|
||||||
|
binding.etRepeatValue.setInputType(InputType.TYPE_NULL);
|
||||||
|
} else {
|
||||||
|
binding.repeatInput.setVisibility(View.GONE);
|
||||||
|
binding.repeatSelectorContainer.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!binding.repeatSwitch.isChecked()) {
|
||||||
|
binding.repeatInput.setVisibility(View.GONE);
|
||||||
|
binding.repeatSelectorContainer.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
binding.repeatSelectedUnit.setText(getString(R.string.infinitely_unit));
|
||||||
|
binding.etRepeatValue.setText("");
|
||||||
|
binding.etRepeatValue.setEnabled(false);
|
||||||
|
binding.etRepeatValue.setInputType(InputType.TYPE_NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.repeatSelectorContainer.setOnClickListener(v -> showUnitSelection(v, TYPE_REPEAT));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupAdvancedMode() {
|
||||||
|
binding.advancedSwitch.setChecked(true);
|
||||||
|
|
||||||
|
binding.advancedSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
|
if (isChecked) {
|
||||||
|
Toast.makeText(getContext(), "Anti-Detection mode is ON", Toast.LENGTH_SHORT).show();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getContext(), "Anti-Detection mode is OFF", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showUnitSelection(View anchorView, int type) {
|
||||||
View popupView = getLayoutInflater().inflate(R.layout.dialog_unit_selection, null);
|
View popupView = getLayoutInflater().inflate(R.layout.dialog_unit_selection, null);
|
||||||
PopupWindow popupWindow = new PopupWindow(
|
PopupWindow popupWindow = new PopupWindow(
|
||||||
popupView,
|
popupView,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
true // 设置为 true,以便点击外部区域时自动关闭
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
// 设置背景,否则点击外部无法关闭
|
|
||||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||||
popupWindow.setOutsideTouchable(true);
|
popupWindow.setOutsideTouchable(true);
|
||||||
|
|
||||||
// 获取弹窗中的TextViews
|
|
||||||
TextView tvMs = popupView.findViewById(R.id.tv_unit_ms);
|
TextView tvMs = popupView.findViewById(R.id.tv_unit_ms);
|
||||||
TextView tvSec = popupView.findViewById(R.id.tv_unit_sec);
|
TextView tvSec = popupView.findViewById(R.id.tv_unit_sec);
|
||||||
TextView tvMin = popupView.findViewById(R.id.tv_unit_min);
|
TextView tvMin = popupView.findViewById(R.id.tv_unit_min);
|
||||||
|
TextView tvInfinitely = popupView.findViewById(R.id.tv_unit_infinitely);
|
||||||
|
TextView tvDuration = popupView.findViewById(R.id.tv_unit_duration);
|
||||||
|
TextView tvCycle = popupView.findViewById(R.id.tv_unit_cycle);
|
||||||
|
|
||||||
// Interval 单位有:毫秒,秒,分钟
|
|
||||||
|
switch (type) {
|
||||||
|
case TYPE_INTERVAL:
|
||||||
tvMs.setVisibility(View.VISIBLE);
|
tvMs.setVisibility(View.VISIBLE);
|
||||||
tvSec.setVisibility(View.VISIBLE);
|
tvSec.setVisibility(View.VISIBLE);
|
||||||
tvMin.setVisibility(View.VISIBLE);
|
tvMin.setVisibility(View.VISIBLE);
|
||||||
|
tvInfinitely.setVisibility(View.GONE);
|
||||||
tvMs.setOnClickListener(v -> {
|
tvDuration.setVisibility(View.GONE);
|
||||||
binding.intervalSelectedUnit.setText(getString(R.string.milliseconds_unit));
|
tvCycle.setVisibility(View.GONE);
|
||||||
popupWindow.dismiss();
|
break;
|
||||||
showInputValue("Interval", binding.etIntervalValue.getText().toString(), getString(R.string.milliseconds_unit));
|
case TYPE_SWIPE_DURATION:
|
||||||
});
|
|
||||||
|
|
||||||
tvSec.setOnClickListener(v -> {
|
|
||||||
binding.intervalSelectedUnit.setText(getString(R.string.seconds_unit));
|
|
||||||
popupWindow.dismiss();
|
|
||||||
showInputValue("Interval", binding.etIntervalValue.getText().toString(), getString(R.string.seconds_unit));
|
|
||||||
});
|
|
||||||
|
|
||||||
tvMin.setOnClickListener(v -> {
|
|
||||||
binding.intervalSelectedUnit.setText(getString(R.string.minutes_unit));
|
|
||||||
popupWindow.dismiss();
|
|
||||||
showInputValue("Interval", binding.etIntervalValue.getText().toString(), getString(R.string.minutes_unit));
|
|
||||||
});
|
|
||||||
|
|
||||||
// 显示弹窗,使其显示在anchorView下方
|
|
||||||
popupWindow.showAsDropDown(anchorView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showSwipeDurationUnitSelection(View anchorView) {
|
|
||||||
// 加载弹窗布局
|
|
||||||
View popupView = getLayoutInflater().inflate(R.layout.dialog_unit_selection, null);
|
|
||||||
PopupWindow popupWindow = new PopupWindow(
|
|
||||||
popupView,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
true // 设置为 true,以便点击外部区域时自动关闭
|
|
||||||
);
|
|
||||||
|
|
||||||
// 设置背景,否则点击外部无法关闭
|
|
||||||
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
||||||
popupWindow.setOutsideTouchable(true);
|
|
||||||
|
|
||||||
// 获取弹窗中的TextViews
|
|
||||||
TextView tvMs = popupView.findViewById(R.id.tv_unit_ms);
|
|
||||||
TextView tvSec = popupView.findViewById(R.id.tv_unit_sec);
|
|
||||||
TextView tvMin = popupView.findViewById(R.id.tv_unit_min);
|
|
||||||
|
|
||||||
// Swipe duration 单位只有:毫秒,秒
|
|
||||||
tvMs.setVisibility(View.VISIBLE);
|
tvMs.setVisibility(View.VISIBLE);
|
||||||
tvSec.setVisibility(View.VISIBLE);
|
tvSec.setVisibility(View.VISIBLE);
|
||||||
tvMin.setVisibility(View.GONE); // 隐藏分钟选项
|
tvMin.setVisibility(View.GONE);
|
||||||
|
tvInfinitely.setVisibility(View.GONE);
|
||||||
|
tvDuration.setVisibility(View.GONE);
|
||||||
|
tvCycle.setVisibility(View.GONE);
|
||||||
|
break;
|
||||||
|
case TYPE_REPEAT:
|
||||||
|
tvMs.setVisibility(View.GONE);
|
||||||
|
tvSec.setVisibility(View.GONE);
|
||||||
|
tvMin.setVisibility(View.GONE);
|
||||||
|
tvInfinitely.setVisibility(View.VISIBLE);
|
||||||
|
tvDuration.setVisibility(View.VISIBLE);
|
||||||
|
tvCycle.setVisibility(View.VISIBLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == TYPE_INTERVAL || type == TYPE_SWIPE_DURATION) {
|
||||||
tvMs.setOnClickListener(v -> {
|
tvMs.setOnClickListener(v -> {
|
||||||
binding.tvSelectedUnit.setText(getString(R.string.milliseconds_unit));
|
String unitText = getString(R.string.milliseconds_unit);
|
||||||
|
if (type == TYPE_INTERVAL) {
|
||||||
|
binding.intervalSelectedUnit.setText(unitText);
|
||||||
|
showInputValue("Interval", binding.etIntervalValue.getText().toString(), unitText);
|
||||||
|
} else {
|
||||||
|
binding.tvSelectedUnit.setText(unitText);
|
||||||
|
showInputValue("Swipe Duration", binding.etDurationValue.getText().toString(), unitText);
|
||||||
|
}
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
showInputValue("Swipe Duration", binding.etDurationValue.getText().toString(), getString(R.string.milliseconds_unit));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
tvSec.setOnClickListener(v -> {
|
tvSec.setOnClickListener(v -> {
|
||||||
binding.tvSelectedUnit.setText(getString(R.string.seconds_unit));
|
String unitText = getString(R.string.seconds_unit);
|
||||||
|
if (type == TYPE_INTERVAL) {
|
||||||
|
binding.intervalSelectedUnit.setText(unitText);
|
||||||
|
showInputValue("Interval", binding.etIntervalValue.getText().toString(), unitText);
|
||||||
|
} else {
|
||||||
|
binding.tvSelectedUnit.setText(unitText);
|
||||||
|
showInputValue("Swipe Duration", binding.etDurationValue.getText().toString(), unitText);
|
||||||
|
}
|
||||||
popupWindow.dismiss();
|
popupWindow.dismiss();
|
||||||
showInputValue("Swipe Duration", binding.etDurationValue.getText().toString(), getString(R.string.seconds_unit));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 显示弹窗,使其显示在anchorView下方
|
if (type == TYPE_INTERVAL) {
|
||||||
|
tvMin.setOnClickListener(v -> {
|
||||||
|
String unitText = getString(R.string.minutes_unit);
|
||||||
|
binding.intervalSelectedUnit.setText(unitText);
|
||||||
|
popupWindow.dismiss();
|
||||||
|
showInputValue("Interval", binding.etIntervalValue.getText().toString(), unitText);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == TYPE_REPEAT) {
|
||||||
|
tvInfinitely.setOnClickListener(v -> {
|
||||||
|
binding.repeatSelectedUnit.setText(getString(R.string.infinitely_unit));
|
||||||
|
binding.etRepeatValue.setText("");
|
||||||
|
binding.etRepeatValue.setEnabled(false);
|
||||||
|
binding.etRepeatValue.setInputType(InputType.TYPE_NULL);
|
||||||
|
popupWindow.dismiss();
|
||||||
|
showInputValue("Repeat", binding.etRepeatValue.getText().toString(), getString(R.string.infinitely_unit));
|
||||||
|
});
|
||||||
|
|
||||||
|
tvDuration.setOnClickListener(v -> {
|
||||||
|
binding.repeatSelectedUnit.setText(getString(R.string.duration_unit));
|
||||||
|
binding.etRepeatValue.setText("");
|
||||||
|
binding.etRepeatValue.setEnabled(true);
|
||||||
|
binding.etRepeatValue.setInputType(InputType.TYPE_CLASS_DATETIME | InputType.TYPE_DATETIME_VARIATION_TIME); // 设置为时间格式
|
||||||
|
popupWindow.dismiss();
|
||||||
|
showInputValue("Repeat", binding.etRepeatValue.getText().toString(), getString(R.string.duration_unit));
|
||||||
|
});
|
||||||
|
|
||||||
|
tvCycle.setOnClickListener(v -> {
|
||||||
|
binding.repeatSelectedUnit.setText(getString(R.string.cycle_unit));
|
||||||
|
binding.etRepeatValue.setText("");
|
||||||
|
binding.etRepeatValue.setEnabled(true);
|
||||||
|
binding.etRepeatValue.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||||
|
popupWindow.dismiss();
|
||||||
|
showInputValue("Repeat", binding.etRepeatValue.getText().toString(), getString(R.string.cycle_unit));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
popupWindow.showAsDropDown(anchorView);
|
popupWindow.showAsDropDown(anchorView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,10 +200,25 @@ public class ActionFragment extends Fragment {
|
|||||||
|
|
||||||
if (type.equals("Interval")) {
|
if (type.equals("Interval")) {
|
||||||
long intervalValue = value.isEmpty() ? 0 : Long.parseLong(value);
|
long intervalValue = value.isEmpty() ? 0 : Long.parseLong(value);
|
||||||
// 根据 unit 进行单位转换或保存
|
// 根据 unit 进行单位转换或保存 Interval 值
|
||||||
|
// 例如:if (unit.equals(getString(R.string.seconds_unit))) { ... }
|
||||||
} else if (type.equals("Swipe Duration")) {
|
} else if (type.equals("Swipe Duration")) {
|
||||||
long durationValue = value.isEmpty() ? 0 : Long.parseLong(value);
|
long durationValue = value.isEmpty() ? 0 : Long.parseLong(value);
|
||||||
// 根据 unit 进行单位转换或保存
|
// 根据 unit 进行单位转换或保存 Swipe Duration 值
|
||||||
|
} else if (type.equals("Repeat")) {
|
||||||
|
if (unit.equals(getString(R.string.infinitely_unit))) {
|
||||||
|
// Repeat 为无限次,不需要处理输入值
|
||||||
|
} else if (unit.equals(getString(R.string.duration_unit))) {
|
||||||
|
// Repeat 为时长,处理时间格式的输入
|
||||||
|
// 您需要在这里添加解析时间格式的逻辑
|
||||||
|
String durationValue = value.isEmpty() ? "0" : value;
|
||||||
|
// long parsedDuration = parseDurationString(durationValue); // 自定义方法解析时间
|
||||||
|
Toast.makeText(getContext(), "Repeat Duration: " + durationValue, Toast.LENGTH_SHORT).show();
|
||||||
|
} else if (unit.equals(getString(R.string.cycle_unit))) {
|
||||||
|
// Repeat 为次数,处理整数输入
|
||||||
|
int repeatCount = value.isEmpty() ? 0 : Integer.parseInt(value);
|
||||||
|
Toast.makeText(getContext(), "Repeat Cycles: " + repeatCount, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import android.view.Gravity;
|
|||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -45,7 +44,8 @@ public class FloatingTabDialogManager {
|
|||||||
|
|
||||||
private EditText inputName;
|
private EditText inputName;
|
||||||
private Button saveButton;
|
private Button saveButton;
|
||||||
private Button closeButton;
|
private Button closeSaveButton;
|
||||||
|
private Button closeLoadButton;
|
||||||
|
|
||||||
private RecyclerView loadRecyclerview;
|
private RecyclerView loadRecyclerview;
|
||||||
private SolutionAdapter solutionsAdapter;
|
private SolutionAdapter solutionsAdapter;
|
||||||
@ -80,7 +80,8 @@ public class FloatingTabDialogManager {
|
|||||||
|
|
||||||
inputName = savePage.findViewById(R.id.script_name_input);
|
inputName = savePage.findViewById(R.id.script_name_input);
|
||||||
saveButton = savePage.findViewById(R.id.save);
|
saveButton = savePage.findViewById(R.id.save);
|
||||||
closeButton = savePage.findViewById(R.id.close);
|
closeSaveButton = savePage.findViewById(R.id.close);
|
||||||
|
closeLoadButton = loadPage.findViewById(R.id.close);
|
||||||
|
|
||||||
saveButton.setOnClickListener(v -> {
|
saveButton.setOnClickListener(v -> {
|
||||||
String solutionName = inputName.getText().toString().trim();
|
String solutionName = inputName.getText().toString().trim();
|
||||||
@ -109,13 +110,15 @@ public class FloatingTabDialogManager {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
closeButton.setOnClickListener(v -> removeFloatingTabDialog());
|
closeSaveButton.setOnClickListener(v -> removeFloatingTabDialog());
|
||||||
|
closeLoadButton.setOnClickListener(v -> removeFloatingTabDialog());
|
||||||
|
|
||||||
loadRecyclerview = loadPage.findViewById(R.id.script_list);
|
loadRecyclerview = loadPage.findViewById(R.id.script_list);
|
||||||
loadRecyclerview.setLayoutManager(new LinearLayoutManager(context));
|
loadRecyclerview.setLayoutManager(new LinearLayoutManager(context));
|
||||||
|
|
||||||
solutionsAdapter = new SolutionAdapter(solutionList, solution -> {
|
solutionsAdapter = new SolutionAdapter(solutionList, solution -> {
|
||||||
if (floatingViewManager != null) {
|
if (floatingViewManager != null) {
|
||||||
|
floatingViewManager.showFloatingViews(solution.getMode());
|
||||||
floatingViewManager.loadSolution(solution.solutionId);
|
floatingViewManager.loadSolution(solution.solutionId);
|
||||||
Toast.makeText(context, "正在加载方案: " + solution.getSolutionName(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "正在加载方案: " + solution.getSolutionName(), Toast.LENGTH_SHORT).show();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -57,6 +57,8 @@ public class FloatingViewManager {
|
|||||||
private static final String TAG = "FloatingViewManager";
|
private static final String TAG = "FloatingViewManager";
|
||||||
public static final long DEBOUNCE_INTERVAL = 500;
|
public static final long DEBOUNCE_INTERVAL = 500;
|
||||||
|
|
||||||
|
private int mode;
|
||||||
|
|
||||||
private int touchPointSize;
|
private int touchPointSize;
|
||||||
|
|
||||||
private int controlBarWidth;
|
private int controlBarWidth;
|
||||||
@ -109,6 +111,8 @@ public class FloatingViewManager {
|
|||||||
throw new SecurityException("需要悬浮窗许可");
|
throw new SecurityException("需要悬浮窗许可");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.mode = mode;
|
||||||
|
|
||||||
removeAllFloatingViews();
|
removeAllFloatingViews();
|
||||||
showMultipleModeViews(mode);
|
showMultipleModeViews(mode);
|
||||||
|
|
||||||
@ -117,7 +121,7 @@ public class FloatingViewManager {
|
|||||||
|
|
||||||
private void showMultipleModeViews(int mode) {
|
private void showMultipleModeViews(int mode) {
|
||||||
initMultipleTouchPointView();
|
initMultipleTouchPointView();
|
||||||
initMultipleControlBar();
|
initMultipleControlBar(mode);
|
||||||
|
|
||||||
if (multipleControlBarView != null) {
|
if (multipleControlBarView != null) {
|
||||||
windowManager.addView(multipleControlBarView, multipleControlBarParams);
|
windowManager.addView(multipleControlBarView, multipleControlBarParams);
|
||||||
@ -129,7 +133,7 @@ public class FloatingViewManager {
|
|||||||
eventOrderCounter = 1;
|
eventOrderCounter = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMultipleControlBar() {
|
private void initMultipleControlBar(int mode) {
|
||||||
if (multipleControlBarView != null) {
|
if (multipleControlBarView != null) {
|
||||||
safeRemoveView(multipleControlBarView);
|
safeRemoveView(multipleControlBarView);
|
||||||
multipleControlBarView = null;
|
multipleControlBarView = null;
|
||||||
@ -142,7 +146,7 @@ public class FloatingViewManager {
|
|||||||
multipleControlBarParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
multipleControlBarParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||||
|
|
||||||
setupDraggableView(multipleControlBarView, multipleControlBarParams, this::updateMoreControlBarPosition);
|
setupDraggableView(multipleControlBarView, multipleControlBarParams, this::updateMoreControlBarPosition);
|
||||||
setupControlButtons(multipleControlBarView);
|
setupControlButtons(multipleControlBarView,mode);
|
||||||
|
|
||||||
updateControlBarImageViews(multipleControlBarView, this.controlBarWidth);
|
updateControlBarImageViews(multipleControlBarView, this.controlBarWidth);
|
||||||
}
|
}
|
||||||
@ -220,7 +224,7 @@ public class FloatingViewManager {
|
|||||||
windowManager.updateViewLayout(multipleControlBarView, multipleControlBarParams);
|
windowManager.updateViewLayout(multipleControlBarView, multipleControlBarParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupControlButtons(LinearLayout controlBar) {
|
private void setupControlButtons(LinearLayout controlBar,int mode) {
|
||||||
ImageView playButton = controlBar.findViewById(R.id.play_button);
|
ImageView playButton = controlBar.findViewById(R.id.play_button);
|
||||||
ImageView addButton = controlBar.findViewById(R.id.add_button);
|
ImageView addButton = controlBar.findViewById(R.id.add_button);
|
||||||
ImageView removeButton = controlBar.findViewById(R.id.remove_button);
|
ImageView removeButton = controlBar.findViewById(R.id.remove_button);
|
||||||
@ -230,6 +234,12 @@ public class FloatingViewManager {
|
|||||||
ImageView settingButton = controlBar.findViewById(R.id.settings_button);
|
ImageView settingButton = controlBar.findViewById(R.id.settings_button);
|
||||||
ImageView closeButton = controlBar.findViewById(R.id.close_button);
|
ImageView closeButton = controlBar.findViewById(R.id.close_button);
|
||||||
|
|
||||||
|
if (mode == 1){
|
||||||
|
addButton.setVisibility(View.GONE);
|
||||||
|
removeButton.setVisibility(View.GONE);
|
||||||
|
slideButton.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
playButton.setOnClickListener(v -> toggleMultipleClicking());
|
playButton.setOnClickListener(v -> toggleMultipleClicking());
|
||||||
addButton.setOnClickListener(v -> addPointEvent());
|
addButton.setOnClickListener(v -> addPointEvent());
|
||||||
removeButton.setOnClickListener(v -> removeLastEvent());
|
removeButton.setOnClickListener(v -> removeLastEvent());
|
||||||
@ -620,32 +630,25 @@ public class FloatingViewManager {
|
|||||||
public void saveCurrentEventsAsSolution(String solutionName, EventRepository.RepositoryCallback<Long> callback) {
|
public void saveCurrentEventsAsSolution(String solutionName, EventRepository.RepositoryCallback<Long> callback) {
|
||||||
if (solutionName == null || solutionName.trim().isEmpty()) {
|
if (solutionName == null || solutionName.trim().isEmpty()) {
|
||||||
Toast.makeText(context, "方案名称不能为空", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "方案名称不能为空", Toast.LENGTH_SHORT).show();
|
||||||
// 在这里调用回调的 onError,或者 onComplete 返回一个表示失败的值
|
|
||||||
// 确保 FloatingTabDialogManager 收到反馈
|
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onComplete(-1L); // 返回一个表示失败的值
|
callback.onComplete(-1L);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (runtimeEvents.isEmpty()) {
|
if (runtimeEvents.isEmpty()) {
|
||||||
Toast.makeText(context, "当前没有事件可以保存", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "当前没有事件可以保存", Toast.LENGTH_SHORT).show();
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onComplete(-1L); // 返回一个表示失败的值
|
callback.onComplete(-1L);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Solution newSolution = new Solution(solutionName);
|
Solution newSolution = new Solution(solutionName,mode);
|
||||||
eventRepository.insertSolutionWithEvents(newSolution, runtimeEvents, new EventRepository.RepositoryCallback<Long>() {
|
eventRepository.insertSolutionWithEvents(newSolution, runtimeEvents, new EventRepository.RepositoryCallback<Long>() {
|
||||||
@Override
|
@Override
|
||||||
public void onComplete(Long solutionId) {
|
public void onComplete(Long solutionId) {
|
||||||
// 成功保存,Toast 可以在这里显示,也可以在 FloatingTabDialogManager 中显示
|
|
||||||
// 为了职责分离,建议在这里显示一个简单的"保存成功" Toast,然后让 FloatingTabDialogManager 决定是否关闭
|
|
||||||
// Toast.makeText(context, "方案 '" + solutionName + "' 保存成功!", Toast.LENGTH_SHORT).show();
|
|
||||||
// 保存失败,Toast 可以在这里显示
|
|
||||||
// Toast.makeText(context, "保存方案失败。", Toast.LENGTH_SHORT).show();
|
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onComplete(solutionId); // 将结果传递给调用者
|
callback.onComplete(solutionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="@android:color/black" />
|
<solid android:color="@android:color/black" />
|
||||||
<stroke android:width="2dp" android:color="@color/gray" />
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="@color/gray" />
|
||||||
<corners android:radius="12dp" />
|
<corners android:radius="12dp" />
|
||||||
</shape>
|
</shape>
|
||||||
|
|||||||
7
app/src/main/res/drawable/close_bg.xml
Normal file
7
app/src/main/res/drawable/close_bg.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<corners android:radius="12dp" />
|
||||||
|
<stroke
|
||||||
|
android:width="2dp"
|
||||||
|
android:color="#1A546B" />
|
||||||
|
</shape>
|
||||||
15
app/src/main/res/drawable/script_option.xml
Normal file
15
app/src/main/res/drawable/script_option.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="3dp"
|
||||||
|
android:height="23dp"
|
||||||
|
android:viewportWidth="3"
|
||||||
|
android:viewportHeight="23">
|
||||||
|
<path
|
||||||
|
android:pathData="M1.5,1.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
|
||||||
|
android:fillColor="#D9D9D9"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
|
||||||
|
android:fillColor="#D9D9D9"/>
|
||||||
|
<path
|
||||||
|
android:pathData="M1.5,21.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"
|
||||||
|
android:fillColor="#D9D9D9"/>
|
||||||
|
</vector>
|
||||||
9
app/src/main/res/drawable/solution_play.xml
Normal file
9
app/src/main/res/drawable/solution_play.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24">
|
||||||
|
<path
|
||||||
|
android:pathData="M12,0C18.627,0 24,5.373 24,12C24,18.627 18.627,24 12,24C5.373,24 0,18.627 0,12C0,5.373 5.373,0 12,0ZM8.143,19.461L20.571,12.286L8.143,5.11V19.461Z"
|
||||||
|
android:fillColor="#ffffff"/>
|
||||||
|
</vector>
|
||||||
@ -22,6 +22,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="23dp"
|
android:layout_marginStart="23dp"
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="23dp"
|
android:layout_marginStart="23dp"
|
||||||
|
|||||||
@ -8,38 +8,58 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_unit_ms"
|
android:id="@+id/tv_unit_ms"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:padding="8dp"
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/milliseconds_unit"
|
android:text="@string/milliseconds_unit"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_unit_sec"
|
android:id="@+id/tv_unit_sec"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:padding="8dp"
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/seconds_unit"
|
android:text="@string/seconds_unit"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_unit_min"
|
android:id="@+id/tv_unit_min"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:padding="8dp"
|
||||||
android:clickable="true"
|
|
||||||
android:focusable="true"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:text="@string/minutes_unit"
|
android:text="@string/minutes_unit"
|
||||||
android:textColor="@color/text_gray"
|
android:textColor="@color/white"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_unit_infinitely"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/infinitely_unit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_unit_duration"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/duration_unit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_unit_cycle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:text="@string/cycle_unit"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="gone" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -204,10 +204,11 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/default_cycle_container"
|
android:id="@+id/default_cycle_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="134dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="20dp"
|
android:layout_marginHorizontal="20dp"
|
||||||
android:layout_marginTop="23dp"
|
android:layout_marginTop="23dp"
|
||||||
android:background="@drawable/bg_rounded_rect"
|
android:background="@drawable/bg_rounded_rect"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/default_actions_container">
|
app:layout_constraintTop_toBottomOf="@+id/default_actions_container">
|
||||||
@ -251,10 +252,11 @@
|
|||||||
android:id="@+id/repeat_switch"
|
android:id="@+id/repeat_switch"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="35dp"
|
android:layout_marginEnd="32dp"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/repeat_text"
|
app:layout_constraintBottom_toBottomOf="@+id/repeat_text"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/repeat_text"
|
app:layout_constraintTop_toTopOf="@+id/repeat_text"
|
||||||
|
app:layout_constraintVertical_bias="0.31"
|
||||||
app:thumbTint="@color/switch_thumb_selector"
|
app:thumbTint="@color/switch_thumb_selector"
|
||||||
app:trackTint="@color/switch_track_selector" />
|
app:trackTint="@color/switch_track_selector" />
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,54 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_height="match_parent">
|
android:layout_width="292dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_rounded_rect"
|
||||||
|
android:backgroundTint="#164958"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="My Script 1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/mode"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/mode"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="1-point Mode"
|
||||||
|
android:textColor="@color/text_gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/title" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/play"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/solution_play"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/option"
|
||||||
|
android:layout_marginEnd="32dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/option"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/script_option"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
45
app/src/main/res/layout/item_solution.xml
Normal file
45
app/src/main/res/layout/item_solution.xml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="250dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_rounded_rect"
|
||||||
|
android:backgroundTint="#164958"
|
||||||
|
android:layout_marginBottom="11dp"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewTopLeft"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="My Script 1"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/textViewBottomLeft"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_chainStyle="packed" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textViewBottomLeft"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
|
android:text="1-point Mode"
|
||||||
|
android:textColor="@color/text_gray"
|
||||||
|
android:textSize="14sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textViewTopLeft" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageViewRight"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/solution_play"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
android:id="@+id/close"
|
android:id="@+id/close"
|
||||||
android:layout_width="223dp"
|
android:layout_width="223dp"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:background="@drawable/btn_border_background"
|
android:background="@drawable/close_bg"
|
||||||
android:text="Close"
|
android:text="Close"
|
||||||
android:textAllCaps="false"
|
android:textAllCaps="false"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
|
|||||||
@ -48,4 +48,7 @@ functionalities.</string>
|
|||||||
<string name="milliseconds_unit">milliseconds</string>
|
<string name="milliseconds_unit">milliseconds</string>
|
||||||
<string name="seconds_unit">seconds</string>
|
<string name="seconds_unit">seconds</string>
|
||||||
<string name="minutes_unit">minutes</string>
|
<string name="minutes_unit">minutes</string>
|
||||||
|
<string name="infinitely_unit">infinitely</string>
|
||||||
|
<string name="duration_unit">Duration</string>
|
||||||
|
<string name="cycle_unit">Cycle</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue
Block a user