-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
343 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package app.akilesh.nex; | ||
|
||
import android.content.Context; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.fragment.app.Fragment; | ||
|
||
import static android.content.ContentValues.TAG; | ||
|
||
|
||
public class DeviceFragment extends Fragment { | ||
private OnFragmentInteractionListener listener; | ||
|
||
static DeviceFragment newInstance() { | ||
return new DeviceFragment(); | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
} | ||
|
||
|
||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.device_fragment, container, false); | ||
|
||
String brand = Build.BRAND; | ||
TextView deviceBrand = view.findViewById(R.id.brand); | ||
deviceBrand.setText(String.format("%s", brand)); | ||
|
||
String model = Build.MODEL; | ||
TextView deviceModel = view.findViewById(R.id.model); | ||
deviceModel.setText(String.format("%s", model)); | ||
|
||
String code = Build.DEVICE; | ||
TextView deviceCodeName = view.findViewById(R.id.codeName); | ||
deviceCodeName.setText(String.format("%s", code)); | ||
|
||
String buildVer = null; | ||
try { | ||
Process process = Runtime.getRuntime().exec("su"); | ||
InputStream in = process.getInputStream(); | ||
OutputStream out = process.getOutputStream(); | ||
String cmd = "cat /data/misc/box/report/PREV_VER"; | ||
out.write(cmd.getBytes()); | ||
out.flush(); | ||
out.close(); | ||
byte[] buffer = new byte[1024]; | ||
int length = in.read(buffer); | ||
buildVer = new String(buffer, 0, length); | ||
process.waitFor(); | ||
} catch (IOException e) { | ||
Log.e(TAG, "IOException, " + e.getMessage()); | ||
} catch (InterruptedException e) { | ||
Log.e(TAG, "InterruptedException, " + e.getMessage()); | ||
} | ||
|
||
TextView build = view.findViewById(R.id.buildVersion); | ||
build.setText(String.format("%s", buildVer)); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public void onAttach(@NonNull Context context) { | ||
super.onAttach(context); | ||
if (context instanceof OnFragmentInteractionListener) { | ||
listener = (OnFragmentInteractionListener) context; | ||
} else { | ||
throw new RuntimeException(context.toString() + " must implement OnFragmentInteractionListener"); | ||
} | ||
} | ||
|
||
@Override | ||
public void onDetach() { | ||
super.onDetach(); | ||
listener = null; | ||
} | ||
|
||
|
||
interface OnFragmentInteractionListener { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical"> | ||
|
||
<androidx.appcompat.widget.AppCompatTextView | ||
android:id="@+id/title" | ||
style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:gravity="center" | ||
android:textColor="@color/colorAccent" | ||
android:text="@string/app_name"/> | ||
|
||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,195 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_marginBottom="?actionBarSize" | ||
android:background="@color/background" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
tools:context=".MainActivity"> | ||
|
||
|
||
|
||
|
||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@color/background" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
|
||
|
||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_margin="16dp" | ||
android:gravity="center_horizontal" | ||
android:orientation="vertical" | ||
android:background="@color/background" | ||
tools:layout_editor_absoluteX="4dp" | ||
tools:layout_editor_absoluteY="50dp"> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
style="@style/Widget.MaterialComponents.CardView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="15dp" | ||
android:innerRadius="0dp" | ||
android:layout_marginLeft="@dimen/mtrl_card_spacing" | ||
android:layout_marginTop="@dimen/mtrl_card_spacing" | ||
android:layout_marginRight="@dimen/mtrl_card_spacing" | ||
android:minHeight="70dp" | ||
app:cardBackgroundColor="@color/background" | ||
tools:ignore="PrivateResource"> | ||
|
||
<TextView | ||
style="?android:attr/listSeparatorTextViewStyle" | ||
android:layout_height="wrap_content" | ||
android:layout_width="match_parent" | ||
android:textAllCaps="false" | ||
android:textColor="@color/colorAccent" | ||
android:layout_marginTop="5dp" | ||
android:background="@color/background" | ||
android:textSize="19sp" | ||
android:text="@string/brand"/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="fill_horizontal" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginTop="35dp" | ||
android:textSize="18sp" | ||
android:background="@color/background" | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:id="@+id/brand"/> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
style="@style/Widget.MaterialComponents.CardView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="15dp" | ||
android:innerRadius="0dp" | ||
android:layout_marginLeft="@dimen/mtrl_card_spacing" | ||
android:layout_marginTop="@dimen/mtrl_card_spacing" | ||
android:layout_marginRight="@dimen/mtrl_card_spacing" | ||
android:minHeight="70dp" | ||
app:cardBackgroundColor="@color/background" | ||
tools:ignore="PrivateResource"> | ||
|
||
<TextView | ||
style="?android:attr/listSeparatorTextViewStyle" | ||
android:layout_height="wrap_content" | ||
android:layout_width="match_parent" | ||
android:textAllCaps="false" | ||
android:textColor="@color/colorAccent" | ||
android:layout_marginTop="5dp" | ||
android:background="@color/background" | ||
android:textSize="19sp" | ||
android:text="@string/model"/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="fill_horizontal" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginTop="35dp" | ||
android:textSize="18sp" | ||
android:background="@color/background" | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:id="@+id/model"/> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
style="@style/Widget.MaterialComponents.CardView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="15dp" | ||
android:innerRadius="0dp" | ||
android:layout_marginLeft="@dimen/mtrl_card_spacing" | ||
android:layout_marginTop="@dimen/mtrl_card_spacing" | ||
android:layout_marginRight="@dimen/mtrl_card_spacing" | ||
android:minHeight="70dp" | ||
app:cardBackgroundColor="@color/background" | ||
tools:ignore="PrivateResource"> | ||
|
||
<TextView | ||
style="?android:attr/listSeparatorTextViewStyle" | ||
android:layout_height="wrap_content" | ||
android:layout_width="match_parent" | ||
android:textAllCaps="false" | ||
android:textColor="@color/colorAccent" | ||
android:layout_marginTop="5dp" | ||
android:background="@color/background" | ||
android:textSize="19sp" | ||
android:text="@string/code_name"/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="fill_horizontal" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginTop="35dp" | ||
android:textSize="18sp" | ||
android:background="@color/background" | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:id="@+id/codeName"/> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
|
||
<com.google.android.material.card.MaterialCardView | ||
style="@style/Widget.MaterialComponents.CardView" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:cardCornerRadius="15dp" | ||
android:innerRadius="0dp" | ||
android:layout_marginLeft="@dimen/mtrl_card_spacing" | ||
android:layout_marginTop="@dimen/mtrl_card_spacing" | ||
android:layout_marginRight="@dimen/mtrl_card_spacing" | ||
android:minHeight="70dp" | ||
app:cardBackgroundColor="@color/background" | ||
tools:ignore="PrivateResource"> | ||
|
||
<TextView | ||
style="?android:attr/listSeparatorTextViewStyle" | ||
android:layout_height="wrap_content" | ||
android:layout_width="match_parent" | ||
android:textAllCaps="false" | ||
android:textColor="@color/colorAccent" | ||
android:layout_marginTop="5dp" | ||
android:background="@color/background" | ||
android:textSize="19sp" | ||
android:text="@string/build_version"/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="fill_horizontal" | ||
android:layout_marginStart="10dp" | ||
android:layout_marginTop="35dp" | ||
android:textSize="18sp" | ||
android:background="@color/background" | ||
android:textColor="?android:attr/textColorPrimary" | ||
android:id="@+id/buildVersion"/> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
<androidx.legacy.widget.Space | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/mtrl_card_spacing" | ||
tools:ignore="PrivateResource" /> | ||
|
||
|
||
</LinearLayout> | ||
|
||
</androidx.core.widget.NestedScrollView> | ||
</androidx.coordinatorlayout.widget.CoordinatorLayout> | ||
|
Oops, something went wrong.