mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-20 08:48:28 +00:00
Apparently, I thought a theme was a good idea...
This commit is contained in:
parent
d2335485f2
commit
c56dd4172e
@ -2,6 +2,8 @@ package com.topjohnwu.magisk;
|
|||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -45,11 +47,9 @@ public class MagiskFragment extends Fragment {
|
|||||||
@BindView(R.id.magisk_check_updates_status) TextView magiskCheckUpdatesStatus;
|
@BindView(R.id.magisk_check_updates_status) TextView magiskCheckUpdatesStatus;
|
||||||
@BindView(R.id.magisk_check_updates_progress) ProgressBar magiskCheckUpdatesProgress;
|
@BindView(R.id.magisk_check_updates_progress) ProgressBar magiskCheckUpdatesProgress;
|
||||||
|
|
||||||
@BindColor(R.color.green500) int green500;
|
|
||||||
@BindColor(R.color.accent) int accent;
|
|
||||||
@BindColor(R.color.blue500) int blue500;
|
|
||||||
@BindColor(R.color.grey500) int grey500;
|
@BindColor(R.color.grey500) int grey500;
|
||||||
|
|
||||||
|
private int colorOK, colorWarn, colorNeutral;
|
||||||
int statusOK = R.drawable.ic_check_circle;
|
int statusOK = R.drawable.ic_check_circle;
|
||||||
int statusUnknown = R.drawable.ic_help;
|
int statusUnknown = R.drawable.ic_help;
|
||||||
|
|
||||||
@ -58,7 +58,18 @@ public class MagiskFragment extends Fragment {
|
|||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View v = inflater.inflate(R.layout.magisk_fragment, container, false);
|
View v = inflater.inflate(R.layout.magisk_fragment, container, false);
|
||||||
ButterKnife.bind(this, v);
|
ButterKnife.bind(this, v);
|
||||||
|
int[] attrs0 = {R.attr.ColorOK};
|
||||||
|
int[] attrs1 = {R.attr.ColorWarn};
|
||||||
|
int[] attrs2 = {R.attr.ColorNeutral};
|
||||||
|
TypedArray ta0 = getActivity().obtainStyledAttributes(attrs0);
|
||||||
|
TypedArray ta1 = getActivity().obtainStyledAttributes(attrs1);
|
||||||
|
TypedArray ta2 = getActivity().obtainStyledAttributes(attrs2);
|
||||||
|
colorOK = ta0.getColor(0, Color.GRAY);
|
||||||
|
colorWarn = ta1.getColor(0, Color.GRAY);
|
||||||
|
colorNeutral = ta2.getColor(0, Color.GRAY);
|
||||||
|
ta0.recycle();
|
||||||
|
ta1.recycle();
|
||||||
|
ta2.recycle();
|
||||||
new updateUI().execute();
|
new updateUI().execute();
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
@ -88,16 +99,16 @@ public class MagiskFragment extends Fragment {
|
|||||||
magiskVersion.setTextColor(grey500);
|
magiskVersion.setTextColor(grey500);
|
||||||
magiskVersion.setText(R.string.magisk_version_error);
|
magiskVersion.setText(R.string.magisk_version_error);
|
||||||
} else {
|
} else {
|
||||||
magiskStatusContainer.setBackgroundColor(green500);
|
magiskStatusContainer.setBackgroundColor(colorOK);
|
||||||
magiskStatusIcon.setImageResource(statusOK);
|
magiskStatusIcon.setImageResource(statusOK);
|
||||||
|
|
||||||
magiskVersion.setTextColor(green500);
|
magiskVersion.setTextColor(colorOK);
|
||||||
magiskVersion.setText(getString(R.string.magisk_version, String.valueOf(Utils.magiskVersion)));
|
magiskVersion.setText(getString(R.string.magisk_version, String.valueOf(Utils.magiskVersion)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.remoteMagiskVersion == -1) {
|
if (Utils.remoteMagiskVersion == -1) {
|
||||||
appCheckUpdatesContainer.setBackgroundColor(accent);
|
appCheckUpdatesContainer.setBackgroundColor(colorWarn);
|
||||||
magiskCheckUpdatesContainer.setBackgroundColor(accent);
|
magiskCheckUpdatesContainer.setBackgroundColor(colorWarn);
|
||||||
|
|
||||||
appCheckUpdatesIcon.setImageResource(R.drawable.ic_warning);
|
appCheckUpdatesIcon.setImageResource(R.drawable.ic_warning);
|
||||||
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_warning);
|
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_warning);
|
||||||
@ -106,7 +117,7 @@ public class MagiskFragment extends Fragment {
|
|||||||
magiskCheckUpdatesStatus.setText(R.string.cannot_check_updates);
|
magiskCheckUpdatesStatus.setText(R.string.cannot_check_updates);
|
||||||
} else {
|
} else {
|
||||||
if (Utils.remoteMagiskVersion > Utils.magiskVersion) {
|
if (Utils.remoteMagiskVersion > Utils.magiskVersion) {
|
||||||
magiskCheckUpdatesContainer.setBackgroundColor(blue500);
|
magiskCheckUpdatesContainer.setBackgroundColor(colorNeutral);
|
||||||
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download);
|
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download);
|
||||||
magiskCheckUpdatesStatus.setText(getString(R.string.magisk_update_available, String.valueOf(Utils.remoteMagiskVersion)));
|
magiskCheckUpdatesStatus.setText(getString(R.string.magisk_update_available, String.valueOf(Utils.remoteMagiskVersion)));
|
||||||
magiskUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity())
|
magiskUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity())
|
||||||
@ -127,13 +138,13 @@ public class MagiskFragment extends Fragment {
|
|||||||
.setNegativeButton(R.string.no_thanks, null)
|
.setNegativeButton(R.string.no_thanks, null)
|
||||||
.show());
|
.show());
|
||||||
} else {
|
} else {
|
||||||
magiskCheckUpdatesContainer.setBackgroundColor(green500);
|
magiskCheckUpdatesContainer.setBackgroundColor(colorOK);
|
||||||
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
|
magiskCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
|
||||||
magiskCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.magisk)));
|
magiskCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.magisk)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.remoteAppVersion > BuildConfig.VERSION_CODE) {
|
if (Utils.remoteAppVersion > BuildConfig.VERSION_CODE) {
|
||||||
appCheckUpdatesContainer.setBackgroundColor(blue500);
|
appCheckUpdatesContainer.setBackgroundColor(colorNeutral);
|
||||||
appCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download);
|
appCheckUpdatesIcon.setImageResource(R.drawable.ic_file_download);
|
||||||
appCheckUpdatesStatus.setText(getString(R.string.app_update_available, String.valueOf(Utils.remoteAppVersion)));
|
appCheckUpdatesStatus.setText(getString(R.string.app_update_available, String.valueOf(Utils.remoteAppVersion)));
|
||||||
appUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity())
|
appUpdateView.setOnClickListener(view -> new AlertDialog.Builder(getActivity())
|
||||||
@ -157,7 +168,7 @@ public class MagiskFragment extends Fragment {
|
|||||||
.show()
|
.show()
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
appCheckUpdatesContainer.setBackgroundColor(green500);
|
appCheckUpdatesContainer.setBackgroundColor(colorOK);
|
||||||
appCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
|
appCheckUpdatesIcon.setImageResource(R.drawable.ic_check_circle);
|
||||||
appCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.app_name)));
|
appCheckUpdatesStatus.setText(getString(R.string.up_to_date, getString(R.string.app_name)));
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import android.graphics.Color;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.IdRes;
|
import android.support.annotation.IdRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
@ -49,6 +50,12 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
String theme = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme","");
|
||||||
|
Logger.dh("MainActivity: Theme is " + theme);
|
||||||
|
if (theme.equals("Dark")) {
|
||||||
|
setTheme(R.style.AppTheme_dh);
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
@ -106,6 +113,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
@ -137,10 +146,17 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
|
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
mView = getToolbarNavigationButton();
|
mView = getToolbarNavigationButton();
|
||||||
if (getIntent().hasExtra("relaunch")) {
|
|
||||||
navigate(R.id.root);
|
|
||||||
|
Bundle extras = getIntent().getExtras();
|
||||||
|
if(extras != null) {
|
||||||
|
Logger.dh("MainActivity: Intent has extras " + getIntent().getExtras().getString("Relaunch"));
|
||||||
|
String data = extras.getString("Relaunch"); // retrieve the data using keyName
|
||||||
|
if (data.contains("Settings")) {
|
||||||
|
navigate(R.id.settings);
|
||||||
}
|
}
|
||||||
startTour();
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageButton getToolbarNavigationButton() {
|
public ImageButton getToolbarNavigationButton() {
|
||||||
|
@ -3,21 +3,24 @@ package com.topjohnwu.magisk;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
|
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.Log;
|
||||||
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.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.ipaulpro.afilechooser.FileInfo;
|
||||||
import com.ipaulpro.afilechooser.utils.FileUtils;
|
import com.ipaulpro.afilechooser.utils.FileUtils;
|
||||||
import com.topjohnwu.magisk.module.Module;
|
import com.topjohnwu.magisk.module.Module;
|
||||||
import com.topjohnwu.magisk.utils.Async;
|
import com.topjohnwu.magisk.utils.Async;
|
||||||
@ -29,10 +32,13 @@ import butterknife.BindView;
|
|||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class ModulesFragment extends Fragment {
|
public class ModulesFragment extends Fragment {
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout)
|
||||||
@BindView(R.id.recyclerView) RecyclerView recyclerView;
|
SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
@BindView(R.id.empty_rv) TextView emptyTv;
|
@BindView(R.id.recyclerView)
|
||||||
private static final int FETCH_ZIP_CODE = 2;
|
RecyclerView recyclerView;
|
||||||
|
@BindView(R.id.empty_rv)
|
||||||
|
TextView emptyTv;
|
||||||
|
private static final int FETCH_ZIP_CODE = 2;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
public static List<Module> listModules = new ArrayList<>();
|
public static List<Module> listModules = new ArrayList<>();
|
||||||
@BindView(R.id.fab)
|
@BindView(R.id.fab)
|
||||||
@ -43,7 +49,6 @@ private static final int FETCH_ZIP_CODE = 2;
|
|||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
View viewMain = inflater.inflate(R.layout.modules_fragment, container, false);
|
View viewMain = inflater.inflate(R.layout.modules_fragment, container, false);
|
||||||
|
|
||||||
|
|
||||||
ButterKnife.bind(this, viewMain);
|
ButterKnife.bind(this, viewMain);
|
||||||
fabio.setOnClickListener(v -> {
|
fabio.setOnClickListener(v -> {
|
||||||
Intent getContentIntent = FileUtils.createGetContentIntent(null);
|
Intent getContentIntent = FileUtils.createGetContentIntent(null);
|
||||||
@ -76,6 +81,23 @@ private static final int FETCH_ZIP_CODE = 2;
|
|||||||
return viewMain;
|
return viewMain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
if (data != null) {
|
||||||
|
// Get the URI of the selected file
|
||||||
|
final Uri uri = data.getData();
|
||||||
|
try {
|
||||||
|
// Get the file path from the URI
|
||||||
|
new Async.FlashZIP(getActivity(), uri).execute();
|
||||||
|
FileInfo fileInfo = FileUtils.getFileInfo(getActivity(), uri);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("FileSelectorTestAc...", "File select error", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.text.SpannableString;
|
|
||||||
import android.text.style.StyleSpan;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -25,11 +22,8 @@ import android.widget.Switch;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.getkeepsafe.taptargetview.TapTarget;
|
|
||||||
import com.getkeepsafe.taptargetview.TapTargetSequence;
|
|
||||||
import com.topjohnwu.magisk.services.MonitorService;
|
import com.topjohnwu.magisk.services.MonitorService;
|
||||||
import com.topjohnwu.magisk.utils.Logger;
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
|
||||||
import com.topjohnwu.magisk.utils.Shell;
|
import com.topjohnwu.magisk.utils.Shell;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
@ -40,6 +34,8 @@ import butterknife.BindColor;
|
|||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
import static com.topjohnwu.magisk.R.attr.cardStyle;
|
||||||
|
|
||||||
public class RootFragment extends Fragment {
|
public class RootFragment extends Fragment {
|
||||||
|
|
||||||
public SharedPreferences prefs;
|
public SharedPreferences prefs;
|
||||||
@ -79,29 +75,37 @@ public class RootFragment extends Fragment {
|
|||||||
TextView safetyNetStatus;
|
TextView safetyNetStatus;
|
||||||
@BindView(R.id.safety_net_icon)
|
@BindView(R.id.safety_net_icon)
|
||||||
ImageView safetyNetStatusIcon;
|
ImageView safetyNetStatusIcon;
|
||||||
@BindColor(R.color.red500)
|
|
||||||
int red500;
|
|
||||||
@BindColor(R.color.green500)
|
|
||||||
int green500;
|
|
||||||
@BindColor(R.color.grey500)
|
|
||||||
int grey500;
|
|
||||||
@BindColor(R.color.accent)
|
|
||||||
int accent;
|
|
||||||
int statusOK = R.drawable.ic_check_circle;
|
int statusOK = R.drawable.ic_check_circle;
|
||||||
int statusAuto = R.drawable.ic_autoroot;
|
int statusAuto = R.drawable.ic_autoroot;
|
||||||
int statusError = R.drawable.ic_error;
|
int statusError = R.drawable.ic_error;
|
||||||
int statusUnknown = R.drawable.ic_help;
|
int statusUnknown = R.drawable.ic_help;
|
||||||
|
|
||||||
|
private int colorOK, colorFail, colorNeutral, colorWarn;
|
||||||
private boolean autoRootStatus;
|
private boolean autoRootStatus;
|
||||||
private View view;
|
|
||||||
private SharedPreferences.OnSharedPreferenceChangeListener listener;
|
private SharedPreferences.OnSharedPreferenceChangeListener listener;
|
||||||
|
private View view;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
view = inflater.inflate(R.layout.root_fragment, container, false);
|
view = inflater.inflate(R.layout.root_fragment, container, false);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
int[] attrs0 = {R.attr.ColorOK};
|
||||||
|
int[] attrs1 = {R.attr.ColorFail};
|
||||||
|
int[] attrs2 = {R.attr.ColorNeutral};
|
||||||
|
int[] attrs3 = {R.attr.ColorWarn};
|
||||||
|
TypedArray ta0 = getActivity().obtainStyledAttributes(attrs0);
|
||||||
|
TypedArray ta1 = getActivity().obtainStyledAttributes(attrs1);
|
||||||
|
TypedArray ta2 = getActivity().obtainStyledAttributes(attrs2);
|
||||||
|
TypedArray ta3 = getActivity().obtainStyledAttributes(attrs3);
|
||||||
|
colorOK = ta0.getColor(0, Color.GRAY);
|
||||||
|
colorFail = ta1.getColor(0, Color.GRAY);
|
||||||
|
colorNeutral = ta2.getColor(0, Color.GRAY);
|
||||||
|
colorWarn = ta2.getColor(0, Color.GRAY);
|
||||||
|
ta0.recycle();
|
||||||
|
ta1.recycle();
|
||||||
|
ta2.recycle();
|
||||||
|
ta3.recycle();
|
||||||
autoRootStatus = Utils.autoToggleEnabled(getActivity());
|
autoRootStatus = Utils.autoToggleEnabled(getActivity());
|
||||||
|
|
||||||
if (autoRootStatus) {
|
if (autoRootStatus) {
|
||||||
@ -128,33 +132,21 @@ public class RootFragment extends Fragment {
|
|||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
listener = (prefs1, key) -> {
|
|
||||||
|
|
||||||
if ((key.contains("autoRootEnable")) | (key.equals("root"))) {
|
|
||||||
Logger.dh("RootFragmnet, keychange detected for " + key);
|
|
||||||
new updateUI().execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
prefs.registerOnSharedPreferenceChangeListener(listener);
|
|
||||||
|
|
||||||
selinuxToggle.setOnClickListener(toggle -> {
|
selinuxToggle.setOnClickListener(toggle -> {
|
||||||
Shell.su(((CompoundButton) toggle).isChecked() ? "setenforce 1" : "setenforce 0");
|
Shell.su(((CompoundButton) toggle).isChecked() ? "setenforce 1" : "setenforce 0");
|
||||||
new updateUI().execute();
|
new updateUI().execute();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
if (null != listener) {
|
||||||
prefs.unregisterOnSharedPreferenceChangeListener(listener);
|
prefs.unregisterOnSharedPreferenceChangeListener(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
@ -162,8 +154,9 @@ public class RootFragment extends Fragment {
|
|||||||
Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode);
|
Log.d("Magisk", "Got result: " + requestCode + " and " + resultCode);
|
||||||
if (requestCode == 100) {
|
if (requestCode == 100) {
|
||||||
if (Utils.hasServicePermission(getActivity())) {
|
if (Utils.hasServicePermission(getActivity())) {
|
||||||
Log.d("Magisk", "Got result code OK for permissions");
|
|
||||||
ToggleAutoRoot(true);
|
ToggleAutoRoot(true);
|
||||||
|
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " has been enabled.", Snackbar.LENGTH_LONG).show();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
autoRootToggle.setChecked(false);
|
autoRootToggle.setChecked(false);
|
||||||
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " disabled, permissions required.", Snackbar.LENGTH_LONG).show();
|
Snackbar.make(view, getActivity().getString(R.string.auto_toggle) + " disabled, permissions required.", Snackbar.LENGTH_LONG).show();
|
||||||
@ -196,6 +189,17 @@ public class RootFragment extends Fragment {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
getActivity().setTitle("Root");
|
getActivity().setTitle("Root");
|
||||||
|
prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||||
|
listener = (prefs1, key) -> {
|
||||||
|
|
||||||
|
if ((key.contains("autoRootEnable")) | (key.equals("root"))) {
|
||||||
|
Logger.dh("RootFragmnet, keychange detected for " + key);
|
||||||
|
new updateUI().execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
prefs.registerOnSharedPreferenceChangeListener(listener);
|
||||||
new updateUI().execute();
|
new updateUI().execute();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -207,7 +211,7 @@ public class RootFragment extends Fragment {
|
|||||||
// Make sure static block invoked
|
// Make sure static block invoked
|
||||||
Shell.rootAccess();
|
Shell.rootAccess();
|
||||||
// Set up Tile on UI Refresh
|
// Set up Tile on UI Refresh
|
||||||
if (PrefHelper.CheckBool("enable_quicktile", getActivity())) {
|
if (PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean("enable_quicktile", false)) {
|
||||||
Utils.SetupQuickSettingsTile(getActivity());
|
Utils.SetupQuickSettingsTile(getActivity());
|
||||||
}
|
}
|
||||||
autoRootStatus = Utils.autoToggleEnabled(getActivity());
|
autoRootStatus = Utils.autoToggleEnabled(getActivity());
|
||||||
@ -232,25 +236,25 @@ public class RootFragment extends Fragment {
|
|||||||
List<String> selinux = Shell.sh("getenforce");
|
List<String> selinux = Shell.sh("getenforce");
|
||||||
|
|
||||||
if (selinux.isEmpty()) {
|
if (selinux.isEmpty()) {
|
||||||
selinuxStatusContainer.setBackgroundColor(grey500);
|
selinuxStatusContainer.setBackgroundColor(colorNeutral);
|
||||||
selinuxStatusIcon.setImageResource(statusUnknown);
|
selinuxStatusIcon.setImageResource(statusUnknown);
|
||||||
|
|
||||||
selinuxStatus.setText(R.string.selinux_error_info);
|
selinuxStatus.setText(R.string.selinux_error_info);
|
||||||
selinuxStatus.setTextColor(grey500);
|
selinuxStatus.setTextColor(colorNeutral);
|
||||||
selinuxToggle.setChecked(false);
|
selinuxToggle.setChecked(false);
|
||||||
} else if (selinux.get(0).equals("Enforcing")) {
|
} else if (selinux.get(0).equals("Enforcing")) {
|
||||||
selinuxStatusContainer.setBackgroundColor(green500);
|
selinuxStatusContainer.setBackgroundColor(colorOK);
|
||||||
selinuxStatusIcon.setImageResource(statusOK);
|
selinuxStatusIcon.setImageResource(statusOK);
|
||||||
|
|
||||||
selinuxStatus.setText(R.string.selinux_enforcing_info);
|
selinuxStatus.setText(R.string.selinux_enforcing_info);
|
||||||
selinuxStatus.setTextColor(green500);
|
selinuxStatus.setTextColor(colorOK);
|
||||||
selinuxToggle.setChecked(true);
|
selinuxToggle.setChecked(true);
|
||||||
} else {
|
} else {
|
||||||
selinuxStatusContainer.setBackgroundColor(red500);
|
selinuxStatusContainer.setBackgroundColor(colorFail);
|
||||||
selinuxStatusIcon.setImageResource(statusError);
|
selinuxStatusIcon.setImageResource(statusError);
|
||||||
|
|
||||||
selinuxStatus.setText(R.string.selinux_permissive_info);
|
selinuxStatus.setText(R.string.selinux_permissive_info);
|
||||||
selinuxStatus.setTextColor(red500);
|
selinuxStatus.setTextColor(colorFail);
|
||||||
selinuxToggle.setChecked(false);
|
selinuxToggle.setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,9 +265,9 @@ public class RootFragment extends Fragment {
|
|||||||
switch (Shell.rootStatus) {
|
switch (Shell.rootStatus) {
|
||||||
case -1:
|
case -1:
|
||||||
// Root Error
|
// Root Error
|
||||||
rootStatusContainer.setBackgroundColor(grey500);
|
rootStatusContainer.setBackgroundColor(colorFail);
|
||||||
rootStatusIcon.setImageResource(statusUnknown);
|
rootStatusIcon.setImageResource(statusUnknown);
|
||||||
rootStatus.setTextColor(grey500);
|
rootStatus.setTextColor(colorNeutral);
|
||||||
rootStatus.setText(R.string.root_error);
|
rootStatus.setText(R.string.root_error);
|
||||||
rootToggle.setChecked(false);
|
rootToggle.setChecked(false);
|
||||||
safetyNetStatusIcon.setImageResource(statusUnknown);
|
safetyNetStatusIcon.setImageResource(statusUnknown);
|
||||||
@ -271,9 +275,9 @@ public class RootFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
// Not rooted
|
// Not rooted
|
||||||
rootStatusContainer.setBackgroundColor(green500);
|
rootStatusContainer.setBackgroundColor(colorOK);
|
||||||
rootStatusIcon.setImageResource(statusOK);
|
rootStatusIcon.setImageResource(statusOK);
|
||||||
rootStatus.setTextColor(green500);
|
rootStatus.setTextColor(colorOK);
|
||||||
rootStatus.setText(R.string.root_none);
|
rootStatus.setText(R.string.root_none);
|
||||||
rootToggle.setChecked(false);
|
rootToggle.setChecked(false);
|
||||||
safetyNetStatusIcon.setImageResource(statusOK);
|
safetyNetStatusIcon.setImageResource(statusOK);
|
||||||
@ -282,10 +286,10 @@ public class RootFragment extends Fragment {
|
|||||||
case 1:
|
case 1:
|
||||||
// Proper root
|
// Proper root
|
||||||
if (autoRootStatus) {
|
if (autoRootStatus) {
|
||||||
rootStatusContainer.setBackgroundColor(green500);
|
rootStatusContainer.setBackgroundColor(colorOK);
|
||||||
rootStatusIcon.setImageResource(statusAuto);
|
rootStatusIcon.setImageResource(statusAuto);
|
||||||
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
|
rootStatusIcon.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP);
|
||||||
rootStatus.setTextColor(green500);
|
rootStatus.setTextColor(colorOK);
|
||||||
rootStatus.setText(R.string.root_auto_unmounted);
|
rootStatus.setText(R.string.root_auto_unmounted);
|
||||||
rootToggle.setEnabled(false);
|
rootToggle.setEnabled(false);
|
||||||
autoRootToggle.setChecked(true);
|
autoRootToggle.setChecked(true);
|
||||||
@ -296,9 +300,9 @@ public class RootFragment extends Fragment {
|
|||||||
rootToggle.setEnabled(true);
|
rootToggle.setEnabled(true);
|
||||||
if (Utils.rootEnabled()) {
|
if (Utils.rootEnabled()) {
|
||||||
// Mounted
|
// Mounted
|
||||||
rootStatusContainer.setBackgroundColor(accent);
|
rootStatusContainer.setBackgroundColor(colorWarn);
|
||||||
rootStatusIcon.setImageResource(statusError);
|
rootStatusIcon.setImageResource(statusError);
|
||||||
rootStatus.setTextColor(accent);
|
rootStatus.setTextColor(colorWarn);
|
||||||
rootStatus.setText(R.string.root_enabled);
|
rootStatus.setText(R.string.root_enabled);
|
||||||
rootToggle.setChecked(true);
|
rootToggle.setChecked(true);
|
||||||
safetyNetStatusIcon.setImageResource(statusError);
|
safetyNetStatusIcon.setImageResource(statusError);
|
||||||
@ -306,9 +310,9 @@ public class RootFragment extends Fragment {
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// Disabled
|
// Disabled
|
||||||
rootStatusContainer.setBackgroundColor(green500);
|
rootStatusContainer.setBackgroundColor(colorOK);
|
||||||
rootStatusIcon.setImageResource(statusOK);
|
rootStatusIcon.setImageResource(statusOK);
|
||||||
rootStatus.setTextColor(green500);
|
rootStatus.setTextColor(colorOK);
|
||||||
rootStatus.setText(R.string.root_disabled);
|
rootStatus.setText(R.string.root_disabled);
|
||||||
rootToggle.setChecked(false);
|
rootToggle.setChecked(false);
|
||||||
safetyNetStatusIcon.setImageResource(statusOK);
|
safetyNetStatusIcon.setImageResource(statusOK);
|
||||||
@ -318,9 +322,9 @@ public class RootFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
// Improper root
|
// Improper root
|
||||||
rootStatusContainer.setBackgroundColor(red500);
|
rootStatusContainer.setBackgroundColor(colorFail);
|
||||||
rootStatusIcon.setImageResource(statusError);
|
rootStatusIcon.setImageResource(statusError);
|
||||||
rootStatus.setTextColor(red500);
|
rootStatus.setTextColor(colorFail);
|
||||||
rootStatus.setText(R.string.root_system);
|
rootStatus.setText(R.string.root_system);
|
||||||
rootToggle.setChecked(true);
|
rootToggle.setChecked(true);
|
||||||
safetyNetStatusIcon.setImageResource(statusError);
|
safetyNetStatusIcon.setImageResource(statusError);
|
||||||
|
@ -1,21 +1,29 @@
|
|||||||
package com.topjohnwu.magisk;
|
package com.topjohnwu.magisk;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.preference.PreferenceScreen;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
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 com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
|
||||||
public class SettingsFragment extends PreferenceFragment {
|
public class SettingsFragment extends PreferenceFragment implements SharedPreferences.OnSharedPreferenceChangeListener{
|
||||||
private CheckBoxPreference quickTilePreference;
|
private CheckBoxPreference quickTilePreference;
|
||||||
|
private ListPreference themePreference;
|
||||||
|
private SharedPreferences.OnSharedPreferenceChangeListener listener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@ -30,6 +38,15 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
getActivity().setTitle("Settings");
|
getActivity().setTitle("Settings");
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getActivity()).unregisterOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,9 +54,11 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile");
|
quickTilePreference = (CheckBoxPreference) findPreference("enable_quicktile");
|
||||||
|
themePreference = (ListPreference) findPreference("theme");
|
||||||
|
PreferenceManager.getDefaultSharedPreferences(getActivity()).registerOnSharedPreferenceChangeListener(this);
|
||||||
CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off");
|
CheckBoxPreference keepRootOffPreference = (CheckBoxPreference) findPreference("keep_root_off");
|
||||||
CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification");
|
CheckBoxPreference hideRootNotificationPreference = (CheckBoxPreference) findPreference("hide_root_notification");
|
||||||
|
themePreference.setSummary(themePreference.getValue());
|
||||||
if (Utils.magiskVersion == -1) {
|
if (Utils.magiskVersion == -1) {
|
||||||
quickTilePreference.setEnabled(false);
|
quickTilePreference.setEnabled(false);
|
||||||
keepRootOffPreference.setEnabled(false);
|
keepRootOffPreference.setEnabled(false);
|
||||||
@ -50,6 +69,7 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
hideRootNotificationPreference.setEnabled(true);
|
hideRootNotificationPreference.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Preference.OnPreferenceClickListener preferenceClickListener = preference -> {
|
Preference.OnPreferenceClickListener preferenceClickListener = preference -> {
|
||||||
if (preference == quickTilePreference) {
|
if (preference == quickTilePreference) {
|
||||||
boolean isChecked = quickTilePreference.isChecked();
|
boolean isChecked = quickTilePreference.isChecked();
|
||||||
@ -64,6 +84,10 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
quickTilePreference.setOnPreferenceClickListener(preferenceClickListener);
|
quickTilePreference.setOnPreferenceClickListener(preferenceClickListener);
|
||||||
// calculate margins
|
// calculate margins
|
||||||
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
|
int horizontalMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
|
||||||
@ -78,5 +102,36 @@ public class SettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
|
Logger.dh("Settings: NewValue is " + key);
|
||||||
|
|
||||||
|
if (key.equals("theme")) {
|
||||||
|
String pref = sharedPreferences.getString(key,"");
|
||||||
|
|
||||||
|
themePreference.setSummary(pref);
|
||||||
|
if (pref.equals("Dark")) {
|
||||||
|
getActivity().getApplication().setTheme(R.style.AppTheme_dh);
|
||||||
|
} else {
|
||||||
|
getActivity().getApplication().setTheme(R.style.AppTheme);
|
||||||
|
}
|
||||||
|
Intent intent = new Intent(getActivity(), MainActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
intent.putExtra("Relaunch","Settings");
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
|
||||||
|
Logger.dh("SettingsFragment: theme is " + pref);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,7 +10,6 @@ import android.support.v7.app.AppCompatActivity;
|
|||||||
import com.topjohnwu.magisk.services.MonitorService;
|
import com.topjohnwu.magisk.services.MonitorService;
|
||||||
import com.topjohnwu.magisk.utils.Async;
|
import com.topjohnwu.magisk.utils.Async;
|
||||||
import com.topjohnwu.magisk.utils.Logger;
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -19,6 +18,9 @@ import java.util.Set;
|
|||||||
public class SplashActivity extends AppCompatActivity {
|
public class SplashActivity extends AppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
if (PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("theme","").equals("Dark")) {
|
||||||
|
setTheme(R.style.AppTheme_dh);
|
||||||
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
//setups go here
|
//setups go here
|
||||||
@ -47,7 +49,7 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
getApplication().startService(myIntent);
|
getApplication().startService(myIntent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (PrefHelper.CheckBool("keep_root_off", getApplication())) {
|
if (PreferenceManager.getDefaultSharedPreferences(getApplication()).getBoolean("keep_root_off", false)) {
|
||||||
Utils.toggleRoot(false, getApplication());
|
Utils.toggleRoot(false, getApplication());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,6 +63,7 @@ public class SplashActivity extends AppCompatActivity {
|
|||||||
new Async.LoadModules(this).execute();
|
new Async.LoadModules(this).execute();
|
||||||
new Async.LoadRepos(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new Async.LoadRepos(this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
|
|
||||||
// Start main activity
|
// Start main activity
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
@ -3,10 +3,10 @@ package com.topjohnwu.magisk.receivers;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.topjohnwu.magisk.services.MonitorService;
|
import com.topjohnwu.magisk.services.MonitorService;
|
||||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
public class AutoStartReceiver extends BroadcastReceiver {
|
public class AutoStartReceiver extends BroadcastReceiver {
|
||||||
@ -15,14 +15,13 @@ public class AutoStartReceiver extends BroadcastReceiver {
|
|||||||
Log.d("Magisk", "Received Boot call, attempting to start service");
|
Log.d("Magisk", "Received Boot call, attempting to start service");
|
||||||
Intent myIntent = new Intent(context, MonitorService.class);
|
Intent myIntent = new Intent(context, MonitorService.class);
|
||||||
context.startService(myIntent);
|
context.startService(myIntent);
|
||||||
if (PrefHelper.CheckBool("keep_root_off",context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("keep_root_off", false)) {
|
||||||
Utils.toggleRoot(false,context);
|
Utils.toggleRoot(false, context);
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("enable_quicktile",context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
|
||||||
Utils.SetupQuickSettingsTile(context);
|
Utils.SetupQuickSettingsTile(context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,7 +18,6 @@ import android.view.accessibility.AccessibilityEvent;
|
|||||||
import com.topjohnwu.magisk.MainActivity;
|
import com.topjohnwu.magisk.MainActivity;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.utils.Logger;
|
import com.topjohnwu.magisk.utils.Logger;
|
||||||
import com.topjohnwu.magisk.utils.PrefHelper;
|
|
||||||
import com.topjohnwu.magisk.utils.Utils;
|
import com.topjohnwu.magisk.utils.Utils;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -109,7 +108,7 @@ public class MonitorService extends AccessibilityService {
|
|||||||
private void ShowNotification(boolean rootAction, String packageName) {
|
private void ShowNotification(boolean rootAction, String packageName) {
|
||||||
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||||
NotificationCompat.Builder mBuilder;
|
NotificationCompat.Builder mBuilder;
|
||||||
if (!PrefHelper.CheckBool("hide_root_notification", getApplicationContext())) {
|
if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getBoolean("hide_root_notification", false)) {
|
||||||
if (rootAction) {
|
if (rootAction) {
|
||||||
|
|
||||||
Intent intent = new Intent(getApplication(), MainActivity.class);
|
Intent intent = new Intent(getApplication(), MainActivity.class);
|
||||||
|
@ -74,15 +74,26 @@ public class TileServiceCompat extends Service {
|
|||||||
private void onSimpleClick() {
|
private void onSimpleClick() {
|
||||||
updateRoots();
|
updateRoots();
|
||||||
updateTile();
|
updateTile();
|
||||||
Utils.toggleAutoRoot(false,getApplicationContext());
|
if (autoRoot) {
|
||||||
Utils.toggleRoot(!root,getApplicationContext());
|
|
||||||
|
|
||||||
|
Utils.toggleAutoRoot(false, getApplicationContext());
|
||||||
|
if (!Utils.hasServicePermission(getApplicationContext())) {
|
||||||
|
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
|
sendBroadcast(it);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Utils.toggleRoot(!root, getApplicationContext());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onLongClick() {
|
private void onLongClick() {
|
||||||
updateRoots();
|
updateRoots();
|
||||||
updateTile();
|
updateTile();
|
||||||
Utils.toggleAutoRoot(!autoRoot,getApplicationContext());
|
Utils.toggleAutoRoot(!autoRoot,getApplicationContext());
|
||||||
|
if (!Utils.hasServicePermission(getApplicationContext())) {
|
||||||
|
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
|
sendBroadcast(it);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTile() {
|
private void updateTile() {
|
||||||
|
@ -5,11 +5,12 @@ import android.content.ContentResolver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.provider.DocumentsContract;
|
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.ipaulpro.afilechooser.FileInfo;
|
||||||
|
import com.ipaulpro.afilechooser.utils.FileUtils;
|
||||||
import com.topjohnwu.magisk.ModulesFragment;
|
import com.topjohnwu.magisk.ModulesFragment;
|
||||||
import com.topjohnwu.magisk.R;
|
import com.topjohnwu.magisk.R;
|
||||||
import com.topjohnwu.magisk.ReposFragment;
|
import com.topjohnwu.magisk.ReposFragment;
|
||||||
@ -87,8 +88,7 @@ public class Async {
|
|||||||
.setTitle(R.string.no_magisk_title)
|
.setTitle(R.string.no_magisk_title)
|
||||||
.setMessage(R.string.no_magisk_msg)
|
.setMessage(R.string.no_magisk_msg)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> new AlertDialog.Builder(mContext)
|
||||||
new AlertDialog.Builder(mContext)
|
|
||||||
.setTitle(R.string.root_method_title)
|
.setTitle(R.string.root_method_title)
|
||||||
.setItems(new String[]{mContext.getString(R.string.phh), mContext.getString(R.string.supersu)}, (dialogInterface1, root) -> {
|
.setItems(new String[]{mContext.getString(R.string.phh), mContext.getString(R.string.supersu)}, (dialogInterface1, root) -> {
|
||||||
Utils.DownloadReceiver rootReceiver;
|
Utils.DownloadReceiver rootReceiver;
|
||||||
@ -132,8 +132,7 @@ public class Async {
|
|||||||
};
|
};
|
||||||
Utils.downloadAndReceive(mContext, magiskReceiver, Utils.magiskLink, "latest_magisk.zip");
|
Utils.downloadAndReceive(mContext, magiskReceiver, Utils.magiskLink, "latest_magisk.zip");
|
||||||
})
|
})
|
||||||
.show();
|
.show())
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no_thanks, null)
|
.setNegativeButton(R.string.no_thanks, null)
|
||||||
.show();
|
.show();
|
||||||
} else if (Shell.rootStatus == 2) {
|
} else if (Shell.rootStatus == 2) {
|
||||||
@ -141,8 +140,7 @@ public class Async {
|
|||||||
.setTitle(R.string.root_system)
|
.setTitle(R.string.root_system)
|
||||||
.setMessage(R.string.root_system_msg)
|
.setMessage(R.string.root_system_msg)
|
||||||
.setCancelable(true)
|
.setCancelable(true)
|
||||||
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> {
|
.setPositiveButton(R.string.download_install, (dialogInterface, i) -> new AlertDialog.Builder(mContext)
|
||||||
new AlertDialog.Builder(mContext)
|
|
||||||
.setTitle(R.string.root_method_title)
|
.setTitle(R.string.root_method_title)
|
||||||
.setItems(new String[]{mContext.getString(R.string.phh), mContext.getString(R.string.supersu)}, (dialogInterface1, root) -> {
|
.setItems(new String[]{mContext.getString(R.string.phh), mContext.getString(R.string.supersu)}, (dialogInterface1, root) -> {
|
||||||
switch (root) {
|
switch (root) {
|
||||||
@ -170,8 +168,7 @@ public class Async {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.show();
|
.show())
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.no_thanks, null)
|
.setNegativeButton(R.string.no_thanks, null)
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
@ -216,8 +213,6 @@ public class Async {
|
|||||||
public static class LoadRepos extends AsyncTask<Void, Void, Void> {
|
public static class LoadRepos extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private boolean doReload;
|
|
||||||
private RepoHelper.TaskDelegate mTaskDelegate;
|
|
||||||
|
|
||||||
public LoadRepos(Context context) {
|
public LoadRepos(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
@ -255,33 +250,31 @@ public class Async {
|
|||||||
mContext = context;
|
mContext = context;
|
||||||
mUri = uRi;
|
mUri = uRi;
|
||||||
deleteFileAfter = true;
|
deleteFileAfter = true;
|
||||||
String file = "";
|
|
||||||
final String docId = DocumentsContract.getDocumentId(mUri);
|
|
||||||
|
|
||||||
Log.d("Magisk", "Utils: FlashZip Running, " + docId + " and " + mUri.toString());
|
String file;
|
||||||
if (docId.contains(":"))
|
FileInfo fileInfo = FileUtils.getFileInfo(context, mUri);
|
||||||
mName = docId.split(":")[1];
|
|
||||||
else mName = docId;
|
Logger.dh("Utils: FlashZip Running, " + fileInfo.getPath());
|
||||||
if (mName.contains("/"))
|
String filename = fileInfo.getPath();
|
||||||
mName = mName.substring(mName.lastIndexOf('/') + 1);
|
String idStr = filename.substring(filename.lastIndexOf('/') + 1);
|
||||||
if (mName.contains(".zip")) {
|
if (!idStr.contains(".zip")) {
|
||||||
file = mContext.getFilesDir() + "/" + mName;
|
Logger.dh("Async: Improper name, cancelling " + idStr);
|
||||||
Log.d("Magisk", "Utils: FlashZip running for uRI " + mUri.toString());
|
|
||||||
} else {
|
|
||||||
Log.e("Magisk", "Utils: error parsing Zipfile " + mUri.getPath());
|
|
||||||
this.cancel(true);
|
this.cancel(true);
|
||||||
|
progress.cancel();
|
||||||
}
|
}
|
||||||
|
file = mContext.getFilesDir() + "/" + idStr;
|
||||||
|
|
||||||
ContentResolver contentResolver = mContext.getContentResolver();
|
ContentResolver contentResolver = mContext.getContentResolver();
|
||||||
//contentResolver.takePersistableUriPermission(mUri, flags);
|
//contentResolver.takePersistableUriPermission(mUri, flags);
|
||||||
try {
|
try {
|
||||||
InputStream in = contentResolver.openInputStream(mUri);
|
InputStream in = contentResolver.openInputStream(mUri);
|
||||||
Log.d("Magisk", "Firing inputStream");
|
Log.d("Magisk", "Firing inputStream");
|
||||||
mFile = createFileFromInputStream(in, file, mContext);
|
mFile = createFileFromInputStream(in, file);
|
||||||
if (mFile != null) {
|
if (mFile != null) {
|
||||||
mPath = mFile.getPath();
|
mPath = mFile.getPath();
|
||||||
Log.d("Magisk", "Utils: Mpath is " + mPath);
|
Logger.dh("Async: Mpath is " + mPath);
|
||||||
} else {
|
} else {
|
||||||
Log.e("Magisk", "Utils: error creating file " + mUri.getPath());
|
Log.e("Magisk", "Async: error creating file " + mUri.getPath());
|
||||||
this.cancel(true);
|
this.cancel(true);
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
@ -292,7 +285,7 @@ public class Async {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File createFileFromInputStream(InputStream inputStream, String fileName, Context context) {
|
private static File createFileFromInputStream(InputStream inputStream, String fileName) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File f = new File(fileName);
|
File f = new File(fileName);
|
||||||
@ -307,12 +300,13 @@ public class Async {
|
|||||||
|
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
Log.d("Magisk", "Holy balls, I think it worked. File is " + f.getPath());
|
Logger.dh("Async: File created successfully - " + f.getPath());
|
||||||
return f;
|
return f;
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("error in creating a file");
|
System.out.println("error in creating a file");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -327,23 +321,24 @@ public class Async {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Void... voids) {
|
protected Boolean doInBackground(Void... voids) {
|
||||||
if (mPath != null) {
|
if (mPath == null) {
|
||||||
Log.e("Magisk", "Utils: Error, flashZIP called without a valid zip file to flash.");
|
Log.e("Magisk", "Utils: Error, flashZIP called without a valid zip file to flash.");
|
||||||
progress.dismiss();
|
|
||||||
this.cancel(true);
|
this.cancel(true);
|
||||||
|
progress.cancel();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Shell.rootAccess()) {
|
if (!Shell.rootAccess()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
ret = Shell.su(
|
ret = Shell.su(
|
||||||
"rm -rf /dev/tmp",
|
"rm -rf /data/tmp",
|
||||||
"mkdir -p /dev/tmp",
|
"mkdir -p /data/tmp",
|
||||||
"cp -af " + mPath + " /dev/tmp/install.zip",
|
"cp -af " + mPath + " /data/tmp/install.zip",
|
||||||
"unzip -o /dev/tmp/install.zip META-INF/com/google/android/* -d /dev/tmp",
|
"unzip -o /data/tmp/install.zip META-INF/com/google/android/* -d /data/tmp",
|
||||||
"BOOTMODE=true sh /dev/tmp/META-INF/com/google/android/update-binary dummy 1 /dev/tmp/install.zip",
|
"BOOTMODE=true sh /data/tmp/META-INF/com/google/android/update-binary dummy 1 /data/tmp/install.zip",
|
||||||
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
|
"if [ $? -eq 0 ]; then echo true; else echo false; fi"
|
||||||
);
|
);
|
||||||
|
Logger.dh("Async: ret is " + ret);
|
||||||
return ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1));
|
return ret != null && Boolean.parseBoolean(ret.get(ret.size() - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,6 +346,7 @@ public class Async {
|
|||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Boolean result) {
|
protected void onPostExecute(Boolean result) {
|
||||||
super.onPostExecute(result);
|
super.onPostExecute(result);
|
||||||
|
//Shell.su("rm -rf /data/tmp");
|
||||||
if (deleteFileAfter) {
|
if (deleteFileAfter) {
|
||||||
Shell.su("rm -rf " + mPath);
|
Shell.su("rm -rf " + mPath);
|
||||||
Log.d("Magisk", "Utils: Deleting file " + mPath);
|
Log.d("Magisk", "Utils: Deleting file " + mPath);
|
||||||
|
@ -2,6 +2,7 @@ package com.topjohnwu.magisk.utils;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
public class Logger {
|
public class Logger {
|
||||||
@ -15,7 +16,7 @@ public class Logger {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("developer_logging", context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("developer_logging", false)) {
|
||||||
if (args.length == 1 && args[0] instanceof Throwable) {
|
if (args.length == 1 && args[0] instanceof Throwable) {
|
||||||
Log.d(LOG_TAG, msg, (Throwable) args[0]);
|
Log.d(LOG_TAG, msg, (Throwable) args[0]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package com.topjohnwu.magisk.utils;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
|
|
||||||
public class PrefHelper {
|
|
||||||
public PrefHelper() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean CheckBool(String key, Context context) {
|
|
||||||
|
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(key, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetBool(String key, Boolean value, Context context) {
|
|
||||||
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -72,10 +72,10 @@ public class Utils {
|
|||||||
if (!Shell.rootAccess()) {
|
if (!Shell.rootAccess()) {
|
||||||
Snackbar.make(((Activity) context).findViewById(android.R.id.content), R.string.no_root_access, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(((Activity) context).findViewById(android.R.id.content), R.string.no_root_access, Snackbar.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("keep_root_off", context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("keep_root_off", false)) {
|
||||||
Utils.toggleRoot(false, context);
|
Utils.toggleRoot(false, context);
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("enable_quicktile", context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
|
||||||
Utils.SetupQuickSettingsTile(context);
|
Utils.SetupQuickSettingsTile(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,10 +137,10 @@ public class Utils {
|
|||||||
} else {
|
} else {
|
||||||
Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0");
|
Shell.su("rm -rf /magisk/.core/bin", "setprop magisk.root 0");
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("enable_quicktile", context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
|
||||||
SetupQuickSettingsTile(context);
|
SetupQuickSettingsTile(context);
|
||||||
}
|
}
|
||||||
PrefHelper.SetBool("root",b,context);
|
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("root",b).apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,6 +156,7 @@ public class Utils {
|
|||||||
Logger.dh("Utils: toggleAuto checks passed, setting" + b );
|
Logger.dh("Utils: toggleAuto checks passed, setting" + b );
|
||||||
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("autoRootEnable", b).apply();
|
PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("autoRootEnable", b).apply();
|
||||||
Intent myServiceIntent = new Intent(context, MonitorService.class);
|
Intent myServiceIntent = new Intent(context, MonitorService.class);
|
||||||
|
myServiceIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
if (b) {
|
if (b) {
|
||||||
context.startService(myServiceIntent);
|
context.startService(myServiceIntent);
|
||||||
} else {
|
} else {
|
||||||
@ -163,7 +164,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PrefHelper.CheckBool("enable_quicktile", context)) {
|
if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("enable_quicktile", false)) {
|
||||||
SetupQuickSettingsTile(context);
|
SetupQuickSettingsTile(context);
|
||||||
}
|
}
|
||||||
UpdateRootFragmentUI(context);
|
UpdateRootFragmentUI(context);
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
|
style="?attr/navStyle"
|
||||||
app:menu="@menu/drawer"/>
|
app:menu="@menu/drawer"/>
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</android.support.v4.widget.DrawerLayout>
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginBottom="@dimen/card_vertical_margin"
|
android:layout_marginBottom="@dimen/card_vertical_margin"
|
||||||
android:layout_marginStart="@dimen/card_horizontal_margin"
|
|
||||||
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
||||||
|
android:layout_marginStart="@dimen/card_horizontal_margin"
|
||||||
android:layout_marginTop="@dimen/card_vertical_margin"
|
android:layout_marginTop="@dimen/card_vertical_margin"
|
||||||
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
style="?attr/cardStyle"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
||||||
card_view:cardElevation="@dimen/card_elevation">
|
card_view:cardElevation="@dimen/card_elevation">
|
||||||
@ -33,11 +33,11 @@
|
|||||||
android:id="@+id/textLayout"
|
android:id="@+id/textLayout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_alignBottom="@+id/app_icon"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingEnd="@dimen/card_appicon_size"
|
android:paddingEnd="@dimen/card_appicon_size"
|
||||||
android:paddingStart="65dp"
|
android:paddingStart="65dp"
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:layout_alignBottom="@+id/app_icon"
|
|
||||||
android:weightSum="1">
|
android:weightSum="1">
|
||||||
|
|
||||||
|
|
||||||
@ -46,21 +46,21 @@
|
|||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="false"
|
android:layout_alignParentEnd="false"
|
||||||
|
android:layout_weight="1"
|
||||||
android:paddingEnd="3dp"
|
android:paddingEnd="3dp"
|
||||||
android:paddingStart="3dp"
|
android:paddingStart="3dp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"/>
|
||||||
android:layout_weight="1"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/app_paackage"
|
android:id="@+id/app_paackage"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
|
android:ellipsize="marquee"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingEnd="3dp"
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
android:paddingStart="3dp"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:marqueeRepeatLimit ="marquee_forever"
|
android:paddingEnd="3dp"
|
||||||
android:ellipsize="marquee"/>
|
android:paddingStart="3dp"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -6,20 +6,20 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginBottom="@dimen/card_vertical_margin"
|
android:layout_marginBottom="@dimen/card_vertical_margin"
|
||||||
android:layout_marginStart="@dimen/card_horizontal_margin"
|
|
||||||
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
||||||
|
android:layout_marginStart="@dimen/card_horizontal_margin"
|
||||||
android:layout_marginTop="@dimen/card_vertical_margin"
|
android:layout_marginTop="@dimen/card_vertical_margin"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
|
style="?attr/cardStyle"
|
||||||
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
||||||
card_view:cardElevation="@dimen/card_elevation">
|
card_view:cardElevation="@dimen/card_elevation">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
android:padding="@dimen/card_layout_padding"
|
android:padding="@dimen/card_layout_padding">
|
||||||
android:layout_gravity="center_vertical">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
@ -30,26 +30,26 @@
|
|||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:textIsSelectable="false" />
|
android:textIsSelectable="false"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/version_name"
|
android:id="@+id/version_name"
|
||||||
android:layout_width="@dimen/card_textview_width"
|
android:layout_width="@dimen/card_textview_width"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@id/title"
|
android:layout_below="@id/title"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="@android:color/tertiary_text_dark"
|
android:textColor="@android:color/tertiary_text_dark"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:textStyle="bold|italic"
|
android:textStyle="bold|italic"/>
|
||||||
android:layout_alignParentStart="true"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_above="@+id/expand_layout"
|
android:layout_above="@+id/expand_layout"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:orientation="horizontal"
|
||||||
android:paddingTop="15dp">
|
android:paddingTop="15dp">
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/checkbox_padding"
|
android:padding="@dimen/checkbox_padding"
|
||||||
android:src="@drawable/ic_menu_overflow_material"
|
android:src="@drawable/ic_menu_overflow_material"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/delete"
|
android:id="@+id/delete"
|
||||||
@ -72,7 +72,7 @@
|
|||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="@dimen/checkbox_padding"
|
android:padding="@dimen/checkbox_padding"
|
||||||
android:src="@drawable/ic_delete"
|
android:src="@drawable/ic_delete"
|
||||||
tools:ignore="ContentDescription" />
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<!--TODO - Work in an auto-update notifier, make this fly around like magic -->
|
<!--TODO - Work in an auto-update notifier, make this fly around like magic -->
|
||||||
@ -96,7 +96,7 @@
|
|||||||
android:layout_below="@id/version_name"
|
android:layout_below="@id/version_name"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textIsSelectable="false" />
|
android:textIsSelectable="false"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/warning"
|
android:id="@+id/warning"
|
||||||
@ -107,7 +107,7 @@
|
|||||||
android:text="@string/remove_file_created"
|
android:text="@string/remove_file_created"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="@color/red500"
|
android:textColor="@color/red500"
|
||||||
android:visibility="gone" />
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/expand_layout"
|
android:id="@+id/expand_layout"
|
||||||
@ -127,17 +127,17 @@
|
|||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="@android:color/tertiary_text_dark"
|
android:textColor="@android:color/tertiary_text_dark"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:textStyle="bold|italic" />
|
android:textStyle="bold|italic"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/updateStatus"
|
android:id="@+id/updateStatus"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginBottom="20dip"
|
android:layout_marginBottom="20dip"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"/>
|
||||||
android:layout_gravity="center_horizontal" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -152,8 +152,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_changelog"
|
||||||
android:background="@drawable/ic_changelog" />
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/authorLink"
|
android:id="@+id/authorLink"
|
||||||
@ -161,8 +161,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_author"
|
||||||
android:background="@drawable/ic_author" />
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/supportLink"
|
android:id="@+id/supportLink"
|
||||||
@ -170,8 +170,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_support"
|
||||||
android:background="@drawable/ic_support" />
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -181,6 +181,4 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
@ -6,11 +6,11 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginBottom="@dimen/card_vertical_margin"
|
android:layout_marginBottom="@dimen/card_vertical_margin"
|
||||||
android:layout_marginStart="@dimen/card_horizontal_margin"
|
|
||||||
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
android:layout_marginEnd="@dimen/card_horizontal_margin"
|
||||||
|
android:layout_marginStart="@dimen/card_horizontal_margin"
|
||||||
android:layout_marginTop="@dimen/card_vertical_margin"
|
android:layout_marginTop="@dimen/card_vertical_margin"
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||||
|
style="?attr/cardStyle"
|
||||||
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
card_view:cardCornerRadius="@dimen/card_corner_radius"
|
||||||
card_view:cardElevation="@dimen/card_elevation">
|
card_view:cardElevation="@dimen/card_elevation">
|
||||||
|
|
||||||
@ -31,47 +31,47 @@
|
|||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="@dimen/card_textview_width"
|
android:layout_width="@dimen/card_textview_width"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:singleLine="false"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textIsSelectable="false"
|
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
android:layout_marginTop="0dp" />
|
android:layout_marginTop="0dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:textIsSelectable="false"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/version_name"
|
android:id="@+id/version_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@id/title"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textColor="@android:color/tertiary_text_dark"
|
android:textColor="@android:color/tertiary_text_dark"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:textStyle="bold|italic"
|
android:textStyle="bold|italic"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@id/title"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/update"
|
android:id="@+id/update"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="false"
|
|
||||||
android:gravity="end"
|
|
||||||
android:background="@drawable/ic_file_download_black"
|
|
||||||
android:backgroundTint="@color/icon_grey"
|
|
||||||
android:layout_gravity="end"
|
|
||||||
android:layout_alignBaseline="@id/title"
|
android:layout_alignBaseline="@id/title"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:background="@drawable/ic_file_download_black"
|
||||||
|
android:backgroundTint="@color/icon_grey"
|
||||||
|
android:focusable="false"
|
||||||
|
android:gravity="end"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@id/update"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
android:layout_below="@id/update"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
@ -79,10 +79,10 @@
|
|||||||
android:id="@+id/expand_layout"
|
android:id="@+id/expand_layout"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@id/description"
|
||||||
android:minHeight="100dp"
|
android:minHeight="100dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_below="@id/description"
|
|
||||||
android:layout_alignParentStart="true"
|
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
@ -108,40 +108,43 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginBottom="20dip"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
android:textIsSelectable="false"
|
android:textIsSelectable="false"/>
|
||||||
android:layout_marginBottom="20dip" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="50dip"
|
android:layout_height="50dip"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:orientation="horizontal"
|
android:layout_marginBottom="0dip"
|
||||||
android:layout_marginBottom="0dip">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/changeLog"
|
android:id="@+id/changeLog"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_changelog"
|
||||||
android:background="@drawable/ic_changelog"/>
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/authorLink"
|
android:id="@+id/authorLink"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_author"
|
||||||
android:background="@drawable/ic_author"/>
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/supportLink"
|
android:id="@+id/supportLink"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
android:backgroundTint="@color/icon_grey"
|
android:background="@drawable/ic_support"
|
||||||
android:background="@drawable/ic_support"/>
|
android:backgroundTint="@color/icon_grey"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -149,18 +152,17 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/installed"
|
android:id="@+id/installed"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="false"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:gravity="end"
|
|
||||||
android:layout_marginEnd="@dimen/card_imageview_margin"
|
android:layout_marginEnd="@dimen/card_imageview_margin"
|
||||||
android:layout_marginStart="@dimen/card_imageview_margin"
|
android:layout_marginStart="@dimen/card_imageview_margin"
|
||||||
|
android:focusable="false"
|
||||||
|
android:gravity="end"
|
||||||
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
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="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:card_view="http://schemas.android.com/tools"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -20,6 +21,7 @@
|
|||||||
android:layout_marginLeft="5dip"
|
android:layout_marginLeft="5dip"
|
||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -70,6 +72,7 @@
|
|||||||
android:layout_marginLeft="5dip"
|
android:layout_marginLeft="5dip"
|
||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -121,6 +124,7 @@
|
|||||||
android:layout_marginLeft="5dip"
|
android:layout_marginLeft="5dip"
|
||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
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="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:card_view="http://schemas.android.com/tools"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginTop="?attr/actionBarSize">
|
android:layout_marginTop="?attr/actionBarSize">
|
||||||
|
|
||||||
@ -23,6 +24,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="2dp"
|
android:elevation="2dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardCornerRadius="0dp">
|
app:cardCornerRadius="0dp">
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
@ -41,6 +43,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="2dp"
|
android:elevation="2dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardCornerRadius="0dp">
|
app:cardCornerRadius="0dp">
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
@ -60,6 +63,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:elevation="2dp"
|
android:elevation="2dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardCornerRadius="0dp">
|
app:cardCornerRadius="0dp">
|
||||||
|
|
||||||
<Switch
|
<Switch
|
||||||
@ -82,6 +86,7 @@
|
|||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -126,6 +131,7 @@
|
|||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@ -162,6 +168,7 @@
|
|||||||
android:layout_marginRight="5dip"
|
android:layout_marginRight="5dip"
|
||||||
android:layout_marginTop="6dp"
|
android:layout_marginTop="6dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="?attr/cardStyle"
|
||||||
app:cardUseCompatPadding="true">
|
app:cardUseCompatPadding="true">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="?attr/colorPrimary"
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
|
||||||
app:theme="@style/AppTheme.Toolbar"/>
|
/>
|
7
app/src/main/res/values/arrays.xml
Normal file
7
app/src/main/res/values/arrays.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string-array name="themes">
|
||||||
|
<item>"Default"</item>
|
||||||
|
<item>"Dark"</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
@ -20,6 +20,12 @@
|
|||||||
<declare-styleable name="RowItem">
|
<declare-styleable name="RowItem">
|
||||||
<attr name="icon" format="reference"/>
|
<attr name="icon" format="reference"/>
|
||||||
<attr name="text" format="string"/>
|
<attr name="text" format="string"/>
|
||||||
|
<attr name="cardStyle" format="reference"/>
|
||||||
|
<attr name="navStyle" format="reference"/>
|
||||||
|
<attr name="ColorOK" format="reference"/>
|
||||||
|
<attr name="ColorWarn" format="reference"/>
|
||||||
|
<attr name="ColorFail" format="reference"/>
|
||||||
|
<attr name="ColorNeutral" format="reference"/>
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
@ -11,5 +11,20 @@
|
|||||||
<color name="green500">#4CAF50</color>
|
<color name="green500">#4CAF50</color>
|
||||||
<color name="blue500">#2196F3</color>
|
<color name="blue500">#2196F3</color>
|
||||||
<color name="grey500">#9E9E9E</color>
|
<color name="grey500">#9E9E9E</color>
|
||||||
|
<color name="yellow500">#FFC107</color>
|
||||||
|
|
||||||
|
<color name="dh_primary">#3F51B5</color>
|
||||||
|
<color name="dh_primary_dark">#303F9F</color>
|
||||||
|
<color name="dh_primary_light">#C5CAE9</color>
|
||||||
|
<color name="dh_accent">#03A9F4</color>
|
||||||
|
|
||||||
|
<color name="dh_primary_text">#dedede</color>
|
||||||
|
<color name="dh_secondary_text">#8A8A8A</color>
|
||||||
|
<color name="dh_icons">#000000</color>
|
||||||
|
<color name="dh_divider">#424242</color>
|
||||||
|
<color name="dh_alertWarn">#FF9800</color>
|
||||||
|
<color name="dh_alertOk">#2196F3</color>
|
||||||
|
<color name="dh_alertNeutral">#2196F3</color>
|
||||||
|
<color name="dh_alertFail">#FF5722</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -127,4 +127,5 @@
|
|||||||
<string name="auto_toggle_apps">Auto-toggle List</string>
|
<string name="auto_toggle_apps">Auto-toggle List</string>
|
||||||
<string name="toast_error_makedir">Error creating directory, could not download file.</string>
|
<string name="toast_error_makedir">Error creating directory, could not download file.</string>
|
||||||
<string name="toast_error_removing_files">Error removing old files, cancelled.</string>
|
<string name="toast_error_removing_files">Error removing old files, cancelled.</string>
|
||||||
|
<string name="settings_general_title">General</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -7,10 +7,14 @@
|
|||||||
<item name="colorAccent">@color/accent</item>
|
<item name="colorAccent">@color/accent</item>
|
||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="cardStyle">@style/CardViewStyle.Light</item>
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="ColorOK">@color/green500</item>
|
||||||
|
<item name="ColorWarn">@color/yellow500</item>
|
||||||
|
<item name="ColorFail">@color/red500</item>
|
||||||
|
<item name="ColorNeutral">@color/grey500</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.Light">
|
<style name="AppTheme.Toolbar" parent="ThemeOverlay.AppCompat.Light">
|
||||||
@ -20,6 +24,45 @@
|
|||||||
<item name="android:textColorSecondary">@color/primary_text</item> <!-- force -->
|
<item name="android:textColorSecondary">@color/primary_text</item> <!-- force -->
|
||||||
<item name="actionMenuTextColor">@color/icons</item>
|
<item name="actionMenuTextColor">@color/icons</item>
|
||||||
</style>
|
</style>
|
||||||
|
<style name="AppTheme.dh" parent="ThemeOverlay.AppCompat.Dark">
|
||||||
|
<item name="colorPrimary">@color/dh_primary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/dh_primary_dark</item>
|
||||||
|
<item name="colorAccent">@color/dh_accent</item>
|
||||||
|
<item name="windowActionModeOverlay">true</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="cardBackgroundColor">@color/dh_accent</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="cardStyle">@style/CardViewStyle.Dark</item>
|
||||||
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
|
<item name="android:textColorPrimary">@color/dh_primary_text</item>
|
||||||
|
<item name="android:textColorSecondary">@color/dh_primary_text</item>
|
||||||
|
<item name="ColorOK">@color/dh_alertOk</item>
|
||||||
|
<item name="ColorWarn">@color/dh_alertWarn</item>
|
||||||
|
<item name="ColorFail">@color/dh_alertFail</item>
|
||||||
|
<item name="ColorNeutral">@color/grey500</item>
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.Toolbar.dh" parent="ThemeOverlay.AppCompat.Dark">
|
||||||
|
<item name="colorPrimary">@color/dh_primary</item>
|
||||||
|
<item name="android:elevation">4dp</item>
|
||||||
|
<item name="android:textColorPrimary">@color/dh_primary_text</item>
|
||||||
|
<item name="android:textColorSecondary">@color/dh_primary_text</item> <!-- force -->
|
||||||
|
<item name="actionMenuTextColor">@color/dh_icons</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="CardViewStyle.Dark" parent="CardView">
|
||||||
|
<item name="cardBackgroundColor">@android:color/background_dark</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style name="CardViewStyle.Light" parent="CardView">
|
||||||
|
<item name="cardBackgroundColor">@android:color/background_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
|
<style name="AppTheme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:title="@string/settings_general_title">
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="theme"
|
||||||
|
android:title="Theme"
|
||||||
|
android:summary="Select a theme"
|
||||||
|
android:entries="@array/themes"
|
||||||
|
android:entryValues="@array/themes"/>
|
||||||
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:title="@string/settings_quicksettings_category">
|
android:title="@string/settings_quicksettings_category">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user