mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-16 19:01:24 +00:00
Small adjustments to UI
This commit is contained in:
parent
36025d6d9f
commit
3ae3d4926a
@ -33,13 +33,10 @@ public class LogFragment extends Fragment {
|
|||||||
|
|
||||||
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
|
TabFragmentAdapter adapter = new TabFragmentAdapter(getChildFragmentManager());
|
||||||
|
|
||||||
if (getApplication().isSuClient) {
|
|
||||||
adapter.addTab(new SuLogFragment(), getString(R.string.superuser));
|
adapter.addTab(new SuLogFragment(), getString(R.string.superuser));
|
||||||
|
adapter.addTab(new MagiskLogFragment(), getString(R.string.magisk));
|
||||||
tab.setupWithViewPager(viewPager);
|
tab.setupWithViewPager(viewPager);
|
||||||
tab.setVisibility(View.VISIBLE);
|
tab.setVisibility(View.VISIBLE);
|
||||||
}
|
|
||||||
|
|
||||||
adapter.addTab(new MagiskLogFragment(), getString(R.string.magisk));
|
|
||||||
|
|
||||||
viewPager.setAdapter(adapter);
|
viewPager.setAdapter(adapter);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import android.widget.CheckBox;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -59,15 +60,12 @@ public class MagiskFragment extends Fragment
|
|||||||
|
|
||||||
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
@BindView(R.id.swipeRefreshLayout) SwipeRefreshLayout mSwipeRefreshLayout;
|
||||||
|
|
||||||
@BindView(R.id.magisk_update_card) CardView magiskUpdateCard;
|
@BindView(R.id.magisk_update) RelativeLayout magiskUpdate;
|
||||||
@BindView(R.id.magisk_update_icon) ImageView magiskUpdateIcon;
|
@BindView(R.id.magisk_update_icon) ImageView magiskUpdateIcon;
|
||||||
@BindView(R.id.magisk_update_status) TextView magiskUpdateText;
|
@BindView(R.id.magisk_update_status) TextView magiskUpdateText;
|
||||||
@BindView(R.id.magisk_update_progress) ProgressBar magiskUpdateProgress;
|
@BindView(R.id.magisk_update_progress) ProgressBar magiskUpdateProgress;
|
||||||
|
|
||||||
@BindView(R.id.magisk_status_icon) ImageView magiskStatusIcon;
|
@BindView(R.id.magisk_status_icon) ImageView magiskStatusIcon;
|
||||||
@BindView(R.id.magisk_version) TextView magiskVersionText;
|
@BindView(R.id.magisk_version) TextView magiskVersionText;
|
||||||
@BindView(R.id.root_status_icon) ImageView rootStatusIcon;
|
|
||||||
@BindView(R.id.root_status) TextView rootStatusText;
|
|
||||||
|
|
||||||
@BindView(R.id.safetyNet_card) CardView safetyNetCard;
|
@BindView(R.id.safetyNet_card) CardView safetyNetCard;
|
||||||
@BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon;
|
@BindView(R.id.safetyNet_refresh) ImageView safetyNetRefreshIcon;
|
||||||
@ -235,7 +233,7 @@ public class MagiskFragment extends Fragment
|
|||||||
boolean hasRoot = Shell.rootAccess();
|
boolean hasRoot = Shell.rootAccess();
|
||||||
boolean isUpToDate = mm.magiskVersionCode > 1300;
|
boolean isUpToDate = mm.magiskVersionCode > 1300;
|
||||||
|
|
||||||
magiskUpdateCard.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
magiskUpdate.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
||||||
safetyNetCard.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
safetyNetCard.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
||||||
bootImageCard.setVisibility(hasNetwork && hasRoot ? View.VISIBLE : View.GONE);
|
bootImageCard.setVisibility(hasNetwork && hasRoot ? View.VISIBLE : View.GONE);
|
||||||
installOptionCard.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
installOptionCard.setVisibility(hasNetwork ? View.VISIBLE : View.GONE);
|
||||||
@ -256,29 +254,6 @@ public class MagiskFragment extends Fragment
|
|||||||
magiskStatusIcon.setImageResource(image);
|
magiskStatusIcon.setImageResource(image);
|
||||||
magiskStatusIcon.setColorFilter(color);
|
magiskStatusIcon.setColorFilter(color);
|
||||||
|
|
||||||
switch (Shell.status) {
|
|
||||||
case 0:
|
|
||||||
color = colorBad;
|
|
||||||
image = R.drawable.ic_cancel;
|
|
||||||
rootStatusText.setText(R.string.not_rooted);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (mm.suVersion != null) {
|
|
||||||
color = colorOK;
|
|
||||||
image = R.drawable.ic_check_circle;
|
|
||||||
rootStatusText.setText(mm.suVersion);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case -1:
|
|
||||||
default:
|
|
||||||
color = colorNeutral;
|
|
||||||
image = R.drawable.ic_help;
|
|
||||||
rootStatusText.setText(R.string.root_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
rootStatusIcon.setImageResource(image);
|
|
||||||
rootStatusIcon.setColorFilter(color);
|
|
||||||
|
|
||||||
List<String> items = new ArrayList<>();
|
List<String> items = new ArrayList<>();
|
||||||
if (mm.bootBlock != null) {
|
if (mm.bootBlock != null) {
|
||||||
items.add(getString(R.string.auto_detect, mm.bootBlock));
|
items.add(getString(R.string.auto_detect, mm.bootBlock));
|
||||||
|
@ -49,8 +49,6 @@ public class MagiskManager extends Application {
|
|||||||
public int remoteManagerVersionCode = -1;
|
public int remoteManagerVersionCode = -1;
|
||||||
public String managerLink;
|
public String managerLink;
|
||||||
public String bootBlock = null;
|
public String bootBlock = null;
|
||||||
public boolean isSuClient = false;
|
|
||||||
public String suVersion = null;
|
|
||||||
public boolean disabled;
|
public boolean disabled;
|
||||||
public int snet_version;
|
public int snet_version;
|
||||||
public int updateServiceVersion;
|
public int updateServiceVersion;
|
||||||
@ -166,11 +164,6 @@ public class MagiskManager extends Application {
|
|||||||
|
|
||||||
public void loadMagiskInfo() {
|
public void loadMagiskInfo() {
|
||||||
List<String> ret;
|
List<String> ret;
|
||||||
ret = Shell.sh("su -v");
|
|
||||||
if (Utils.isValidShellResponse(ret)) {
|
|
||||||
suVersion = ret.get(0);
|
|
||||||
isSuClient = suVersion.toUpperCase().contains("MAGISK");
|
|
||||||
}
|
|
||||||
ret = Shell.sh("magisk -v");
|
ret = Shell.sh("magisk -v");
|
||||||
if (!Utils.isValidShellResponse(ret)) {
|
if (!Utils.isValidShellResponse(ret)) {
|
||||||
ret = Shell.sh("getprop magisk.version");
|
ret = Shell.sh("getprop magisk.version");
|
||||||
|
@ -138,8 +138,7 @@ public class MainActivity extends Activity
|
|||||||
menu.findItem(R.id.downloads).setVisible(Utils.checkNetworkStatus() &&
|
menu.findItem(R.id.downloads).setVisible(Utils.checkNetworkStatus() &&
|
||||||
Shell.rootAccess() && getMagiskManager().magiskVersionCode >= 0);
|
Shell.rootAccess() && getMagiskManager().magiskVersionCode >= 0);
|
||||||
menu.findItem(R.id.log).setVisible(Shell.rootAccess());
|
menu.findItem(R.id.log).setVisible(Shell.rootAccess());
|
||||||
menu.findItem(R.id.superuser).setVisible(
|
menu.findItem(R.id.superuser).setVisible(Shell.rootAccess());
|
||||||
Shell.rootAccess() && getMagiskManager().isSuClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void navigate(String item) {
|
public void navigate(String item) {
|
||||||
|
@ -138,15 +138,10 @@ public class SettingsActivity extends Activity implements Topic.Subscriber {
|
|||||||
prefScreen.removePreference(magiskCategory);
|
prefScreen.removePreference(magiskCategory);
|
||||||
prefScreen.removePreference(suCategory);
|
prefScreen.removePreference(suCategory);
|
||||||
generalCatagory.removePreference(hideManager);
|
generalCatagory.removePreference(hideManager);
|
||||||
} else {
|
} else if (mm.magiskVersionCode < 1300) {
|
||||||
if (!mm.isSuClient) {
|
|
||||||
prefScreen.removePreference(suCategory);
|
|
||||||
}
|
|
||||||
if (mm.magiskVersionCode < 1300) {
|
|
||||||
prefScreen.removePreference(magiskCategory);
|
prefScreen.removePreference(magiskCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setLocalePreference(ListPreference lp) {
|
private void setLocalePreference(ListPreference lp) {
|
||||||
boolean isNew = lp == null;
|
boolean isNew = lp == null;
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
<android.support.v7.widget.CardView
|
||||||
android:id="@+id/magisk_update_card"
|
|
||||||
style="?attr/cardStyle"
|
style="?attr/cardStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@ -32,7 +31,15 @@
|
|||||||
app:cardCornerRadius="@dimen/card_corner_radius"
|
app:cardCornerRadius="@dimen/card_corner_radius"
|
||||||
app:cardElevation="@dimen/card_elevation">
|
app:cardElevation="@dimen/card_elevation">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:id="@+id/magisk_update"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
@ -41,9 +48,7 @@
|
|||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_margin="15dp"
|
|
||||||
android:layout_toStartOf="@+id/magisk_update_status"
|
android:layout_toStartOf="@+id/magisk_update_status"
|
||||||
android:src="@drawable/ic_refresh"
|
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
@ -51,7 +56,6 @@
|
|||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_margin="15dp"
|
|
||||||
android:layout_toStartOf="@+id/magisk_update_status" />
|
android:layout_toStartOf="@+id/magisk_update_status" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -68,29 +72,11 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
|
||||||
|
|
||||||
<android.support.v7.widget.CardView
|
|
||||||
style="?attr/cardStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="4dp"
|
|
||||||
android:layout_marginEnd="5dp"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
app:cardCornerRadius="@dimen/card_corner_radius"
|
|
||||||
app:cardElevation="@dimen/card_elevation" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="15dp"
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="5dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@ -98,8 +84,6 @@
|
|||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
android:layout_marginEnd="15dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_toStartOf="@+id/magisk_version" />
|
android:layout_toStartOf="@+id/magisk_version" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -116,35 +100,6 @@
|
|||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginBottom="15dp"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/root_status_icon"
|
|
||||||
android:layout_width="25dp"
|
|
||||||
android:layout_height="25dp"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_marginEnd="15dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:layout_toStartOf="@+id/root_status" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/root_status"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:gravity="center"
|
|
||||||
android:minWidth="225dp"
|
|
||||||
android:padding="6dp"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</android.support.v7.widget.CardView>
|
</android.support.v7.widget.CardView>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user