Skip to content

Commit

Permalink
fixed bugs with app didnt ask root for new installs, added resolution…
Browse files Browse the repository at this point in the history
… to shortcut name
  • Loading branch information
onur committed Nov 17, 2023
1 parent dda5c7d commit 362e93f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/src/main/java/com/runoono/screenfixer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ protected void onCreate(Bundle savedInstanceState) {
set_res_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RootProvider.EnableRoot();
RootProvider.RunAsRoot("wm size "+xBox.getText().toString()+"x"+yBox.getText().toString());
}
});
res_sys_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RootProvider.EnableRoot();
RootProvider.RunAsRoot("killall com.android.systemui");
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
Expand All @@ -53,6 +55,7 @@ public void onClick(View v) {
res_res_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RootProvider.EnableRoot();
RootProvider.RunAsRoot("wm size reset");
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;
Expand Down
16 changes: 13 additions & 3 deletions app/src/main/java/com/runoono/screenfixer/shortcutCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Intent;
import android.content.pm.ShortcutInfo;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
Expand All @@ -19,18 +20,27 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_shortcut_creator);

RootProvider.EnableRoot();

DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;

EditText xBox = findViewById(R.id.shortcut_x);
EditText yBox = findViewById(R.id.shortcut_y);
xBox.setText(width+"");
yBox.setText(height+"");
Button b = findViewById(R.id.shortcut_button);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
Intent executionIntent = new Intent(shortcutCreator.this, shortcutLauncher.class);
executionIntent.putExtra("resolution",xBox.getText().toString()+"x"+yBox.getText().toString());
String resolution = xBox.getText().toString()+"x"+yBox.getText().toString();
executionIntent.putExtra("resolution", resolution);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, executionIntent);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Toggle Mini Mode");

intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, String.format("Toggle Mini Mode (%s)", resolution));
setResult(RESULT_OK, intent);
finish();
}
Expand Down

0 comments on commit 362e93f

Please sign in to comment.