mirror of
https://github.com/Xcreen/RestSMS.git
synced 2026-04-18 06:07:40 -04:00
Show Check-Icon for SMS-Permission under App-Information
This commit is contained in:
@@ -3,6 +3,7 @@ package net.xcreen.restsms.fragments;
|
||||
import android.Manifest;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -14,6 +15,7 @@ import android.telephony.TelephonyManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.xcreen.restsms.BuildConfig;
|
||||
@@ -39,16 +41,15 @@ public class AboutAppFragment extends Fragment {
|
||||
versionNameResultTV.setText(String.valueOf(BuildConfig.VERSION_CODE));
|
||||
|
||||
//Check if has SMS-Permission
|
||||
TextView smsPermissionResultTV = rootView.findViewById(R.id.about_app_smspermission_result_textview);
|
||||
ImageView smsPermissionResultImageView = rootView.findViewById(R.id.about_app_smspermission_result_iv);
|
||||
smsPermissionResultImageView.setColorFilter(getContext().getColor(R.color.colorError), PorterDuff.Mode.SRC_ATOP);
|
||||
try {
|
||||
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED) {
|
||||
smsPermissionResultTV.setText(R.string.yes);
|
||||
} else {
|
||||
smsPermissionResultTV.setText(R.string.no);
|
||||
smsPermissionResultImageView.setImageDrawable(getContext().getDrawable(R.drawable.check_yes));
|
||||
smsPermissionResultImageView.setColorFilter(getContext().getColor(R.color.colorPrimary), PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
}
|
||||
catch (Exception ex){
|
||||
smsPermissionResultTV.setText(R.string.unknown);
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable/check_no.png
Normal file
BIN
app/src/main/res/drawable/check_no.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
BIN
app/src/main/res/drawable/check_yes.png
Normal file
BIN
app/src/main/res/drawable/check_yes.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.7 KiB |
@@ -74,15 +74,13 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/about_app_versionname_textview" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_app_smspermission_result_textview"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
<ImageView
|
||||
android:id="@+id/about_app_smspermission_result_iv"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
|
||||
android:src="@drawable/check_no"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/about_app_versionname_result_textview" />
|
||||
|
||||
@@ -105,10 +103,10 @@
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:text="@string/unknown"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Body2"
|
||||
android:textColor="@color/colorWhite"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/about_app_smspermission_result_textview" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/about_app_smspermission_result_iv" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/about_app_sim2state_textview"
|
||||
|
||||
@@ -9,4 +9,5 @@
|
||||
<color name="colorDarkBlack">#202020</color>
|
||||
<color name="colorLightBlack">#616161</color>
|
||||
<color name="colorWhite">#FFF</color>
|
||||
<color name="colorError">#ff0011</color>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user