Closed zezung27 closed 2 years ago
public void handleChangeWidth() { imgIncreaseWidth.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(currentProgressWidth < maxW) { currentProgressWidth++; txtWidth.setText(currentProgressWidth +""); mWindowPopup.changeWidth(currentProgressWidth); } } });
imgDecreaseWidth.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(currentProgressWidth > minW) {
currentProgressWidth--;
txtWidth.setText(currentProgressWidth +"");
mWindowPopup.changeWidth(currentProgressWidth);
}
}
});
widthSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
currentProgressWidth = i;
txtWidth.setText(currentProgressWidth +"");
mWindowPopup.changeWidth(currentProgressWidth);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void handleChangeHeight() {
imgIncreaseHeight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(currentProgressHeight < maxH) {
currentProgressHeight++;
txtHeight.setText(currentProgressHeight +"");
mWindowPopup.changeHeight(currentProgressHeight);
}
}
});
imgDecreaseHeight.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(currentProgressHeight > minH) {
currentProgressHeight--;
txtHeight.setText(currentProgressHeight +"");
mWindowPopup.changeHeight(currentProgressHeight);
}
}
});
heightSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
currentProgressHeight = i;
txtHeight.setText(currentProgressHeight +"");
mWindowPopup.changeHeight(currentProgressHeight);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
public void updateParamPosValue() {
String currentPos = mWindowPopup.getCurrentPosition();
switch(currentPos) {
case "LEFT":
rbLeft.setChecked(true);
break;
case "CENTER":
rbCenter.setChecked(true);
break;
case "RIGHT":
rbRight.setChecked(true);
break;
default: break;
}
}
public void onRadioButtonClicked(View view) {
boolean checked = ((RadioButton) view).isChecked();
currentProgressLeftRight = 0;
updateChangeXPos();
switch(view.getId()) {
case R.id.radio_right:
if (checked)
mWindowPopup.changeRight();
break;
case R.id.radio_left:
if (checked)
mWindowPopup.changeLeft();
break;
case R.id.radio_center:
if (checked)
mWindowPopup.changeCenter();
break;
default: break;
}
}
public void updateChangeXPos() {
txtLeftRight.setText(String.valueOf(currentProgressLeftRight));
leftRightSeekbar.setProgress(currentProgressLeftRight);
mWindowPopup.changeX(currentProgressLeftRight);
}
public void handleLeftRightPos() {
imgIncreaseLR.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(currentProgressLeftRight < maxWidthDevice) {
currentProgressLeftRight++;
updateChangeXPos();
}
}
});
imgDecreaseLR.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(currentProgressLeftRight > 0 ) {
currentProgressLeftRight--;
updateChangeXPos();
}
}
});
leftRightSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean b) {
currentProgressLeftRight = progress;
updateChangeXPos();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
}
package com.matcos.dynamicislandlight;
import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity;
import android.content.res.Resources; import android.os.Build; import android.os.Bundle; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast;
import com.matcos.dynamicislandlight.core.service.MainAccessibilityService; import com.matcos.dynamicislandlight.core.service.WindowPopup; import com.matcos.dynamicislandlight.utils.Contanst; import com.matcos.dynamicislandlight.utils.Utils;
import org.w3c.dom.Text;
public class DisplaySettingActivity extends AppCompatActivity { private WindowPopup mWindowPopup; private RadioButton rbLeft, rbCenter, rbRight; private TextView txtTop, txtLeftRight, txtWidth, txtHeight; private ImageView imgBack, imgIncreaseTop, imgDecreaseTop, imgIncreaseLR, imgDecreaseLR, imgIncreaseWidth, imgDecreaseWidth, imgIncreaseHeight, imgDecreaseHeight; private SeekBar topSeekbar, leftRightSeekbar, widthSeekbar, heightSeekbar; private int currentProgressTop, currentProgressLeftRight, currentProgressWidth, currentProgressHeight; private int maxWidthDevice, minW, maxW, minH, maxH;