mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-13 05:37:47 +02:00
Fix some thangs
This commit is contained in:
@ -36,6 +36,7 @@ public class AutoRootFragment extends ListFragment {
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
View view = inflater.inflate(R.layout.auto_root_fragment, container, false);
|
||||
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
|
||||
int verticalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
|
||||
|
@ -5,6 +5,7 @@ import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@ -19,10 +20,12 @@ import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.topjohnwu.magisk.utils.Logger;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
@ -32,6 +35,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
private final Handler mDrawerHandler = new Handler();
|
||||
private String currentTitle;
|
||||
private View mView;
|
||||
|
||||
@BindView(R.id.toolbar)
|
||||
Toolbar toolbar;
|
||||
@ -100,7 +104,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
navigationView.setCheckedItem(R.id.settings);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
);
|
||||
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
@ -130,9 +136,25 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
}
|
||||
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
mView = getToolbarNavigationButton();
|
||||
if (getIntent().hasExtra("relaunch")) {
|
||||
navigate(R.id.root);
|
||||
}
|
||||
startTour();
|
||||
}
|
||||
|
||||
public ImageButton getToolbarNavigationButton() {
|
||||
int size = toolbar.getChildCount();
|
||||
for (int i = 0; i < size; i++) {
|
||||
View child = toolbar.getChildAt(i);
|
||||
if (child instanceof ImageButton) {
|
||||
ImageButton btn = (ImageButton) child;
|
||||
if (btn.getDrawable() == toolbar.getNavigationIcon()) {
|
||||
return btn;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,6 +163,11 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
}
|
||||
|
||||
private void startTour() {
|
||||
navigate(R.id.root);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
@ -3,6 +3,7 @@ package com.topjohnwu.magisk;
|
||||
import android.app.Fragment;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
@ -20,6 +21,7 @@ import com.topjohnwu.magisk.module.Repo;
|
||||
import com.topjohnwu.magisk.module.RepoHelper;
|
||||
import com.topjohnwu.magisk.utils.Async;
|
||||
import com.topjohnwu.magisk.utils.Utils;
|
||||
import com.wooplr.spotlight.SpotlightView;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@ -29,6 +31,8 @@ import java.util.List;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
import static com.topjohnwu.magisk.R.menu.drawer;
|
||||
|
||||
public class ReposFragment extends Fragment {
|
||||
|
||||
public static List<Repo> mListRepos = new ArrayList<>();
|
||||
@ -74,6 +78,7 @@ public class ReposFragment extends Fragment {
|
||||
CheckForUpdates();
|
||||
Log.d("Magisk", "ReposFragment: ListRepos size is " + listRepos().size());
|
||||
recyclerView.setAdapter(new ReposAdapter(this, mListRepos));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,19 @@
|
||||
package com.topjohnwu.magisk;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.text.SpannableString;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -21,6 +25,8 @@ import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.getkeepsafe.taptargetview.TapTarget;
|
||||
import com.getkeepsafe.taptargetview.TapTargetSequence;
|
||||
import com.topjohnwu.magisk.services.MonitorService;
|
||||
import com.topjohnwu.magisk.utils.Logger;
|
||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
||||
@ -138,6 +144,7 @@ public class RootFragment extends Fragment {
|
||||
new updateUI().execute();
|
||||
});
|
||||
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@ -147,6 +154,8 @@ public class RootFragment extends Fragment {
|
||||
prefs.unregisterOnSharedPreferenceChangeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
// Check which request we're responding to
|
||||
@ -188,6 +197,7 @@ public class RootFragment extends Fragment {
|
||||
super.onResume();
|
||||
getActivity().setTitle("Root");
|
||||
new updateUI().execute();
|
||||
|
||||
}
|
||||
|
||||
public class updateUI extends AsyncTask<Void, Void, Void> {
|
||||
|
@ -20,6 +20,7 @@ public class SplashActivity extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//setups go here
|
||||
|
||||
// Set up default preferences,make sure we add "extra" blacklist entries.
|
||||
@ -63,7 +64,7 @@ public class SplashActivity extends AppCompatActivity {
|
||||
// Start main activity
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,9 @@ public class TileServiceCompat extends Service {
|
||||
private void onSimpleClick() {
|
||||
updateRoots();
|
||||
updateTile();
|
||||
Utils.toggleAutoRoot(false,getApplicationContext());
|
||||
Utils.toggleRoot(!root,getApplicationContext());
|
||||
|
||||
}
|
||||
|
||||
private void onLongClick() {
|
||||
|
@ -145,6 +145,7 @@ public class Utils {
|
||||
}
|
||||
|
||||
public static void toggleAutoRoot(Boolean b, Context context) {
|
||||
Logger.dh("Utils: toggleAutocalled for " + b );
|
||||
if (Utils.magiskVersion != -1) {
|
||||
if (!Utils.hasServicePermission(context)) {
|
||||
Intent intent = new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||
@ -152,6 +153,7 @@ public class Utils {
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
} else {
|
||||
Logger.dh("Utils: toggleAuto checks passed, setting" + b );
|
||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("autoRootEnable", b).apply();
|
||||
Intent myServiceIntent = new Intent(context, MonitorService.class);
|
||||
if (b) {
|
||||
|
Reference in New Issue
Block a user