.
This commit is contained in:
@@ -7,6 +7,15 @@
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
|
||||
<!-- permissions for app blocking-->
|
||||
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
@@ -126,6 +135,24 @@
|
||||
android:value="" />
|
||||
</activity>
|
||||
|
||||
<!-- // app blocking stuff-->
|
||||
<activity android:name=".appblocking.FUAActivity"/>
|
||||
|
||||
<activity android:name=".appblocking.BlockApp"/>
|
||||
|
||||
<service
|
||||
android:name=".appblocking.TopAppDetectionService"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.accessibilityservice"
|
||||
android:resource="@xml/accessibility_service_config" />
|
||||
</service>
|
||||
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="com.ssb.simplitend.fileProvider"
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
public class AppList {
|
||||
private final String name;
|
||||
Drawable icon;
|
||||
private final String packages;
|
||||
public AppList(String name, Drawable icon, String packages) {
|
||||
this.name = name;
|
||||
this.icon = icon;
|
||||
this.packages = packages;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public Drawable getIcon() {
|
||||
return icon;
|
||||
}
|
||||
public String getPackages() {
|
||||
return packages;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
|
||||
public class BlockApp extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.overlay_layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class FUAActivity extends AppCompatActivity {
|
||||
|
||||
private static final String TAG = "aditya";
|
||||
|
||||
SwitchCompat swBlock;
|
||||
RecyclerView rvApps, rvWhiteApps;
|
||||
MyAppsAdapter adapter, whiteListAdapter;
|
||||
MySharedPref mySharedPref;
|
||||
List<AppList> whiteList;
|
||||
|
||||
List<AppList> installed_app_list;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_fua);
|
||||
|
||||
swBlock = (SwitchCompat) findViewById(R.id.swBlock);
|
||||
rvApps = (RecyclerView) findViewById(R.id.rvApps);
|
||||
rvWhiteApps = (RecyclerView) findViewById(R.id.rv_white_apps);
|
||||
mySharedPref = new MySharedPref(FUAActivity.this);
|
||||
|
||||
if (!isAccessibilityAppBlockingEnabled()) {
|
||||
openAccessibilityDialog();
|
||||
}
|
||||
|
||||
Intent serviceIntent = new Intent(getApplicationContext(), TopAppDetectionService.class);
|
||||
getApplicationContext().startService(serviceIntent);
|
||||
|
||||
whiteList = getWhiteListApps();
|
||||
Collections.sort(whiteList, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
|
||||
|
||||
adapter = new MyAppsAdapter(FUAActivity.this, getInstalledApps(), false, appList -> {
|
||||
if (!isContainsWhiteList(appList)) {
|
||||
whiteList.add(appList);
|
||||
Collections.sort(whiteList, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
|
||||
} else {
|
||||
whiteList.remove(getPosition(appList));
|
||||
}
|
||||
|
||||
whiteListAdapter.notifyDataSetChanged();
|
||||
});
|
||||
|
||||
whiteListAdapter = new MyAppsAdapter(FUAActivity.this, whiteList, true, new MyAppsAdapter.ItemClicked() {
|
||||
@Override
|
||||
public void onCLick(AppList appList) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
rvApps.setLayoutManager(new GridLayoutManager(this, 4));
|
||||
rvApps.setAdapter(adapter);
|
||||
|
||||
rvWhiteApps.setLayoutManager(new GridLayoutManager(this, 4));
|
||||
rvWhiteApps.setAdapter(whiteListAdapter);
|
||||
|
||||
swBlock.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
|
||||
if (!isAccessibilityAppBlockingEnabled() && isChecked) {
|
||||
Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||
startActivity(accessibilityIntent);
|
||||
}
|
||||
//
|
||||
// // Intent serviceIntent = new Intent(getApplicationContext(), service.class);
|
||||
//// ContextCompat.startForegroundService(getApplicationContext(), serviceIntent);
|
||||
//
|
||||
// // if (isChecked) {
|
||||
//
|
||||
// // startService(new Intent(MainActivity.this, ServiceTest.class));
|
||||
//
|
||||
//// Intent serviceIntent = new Intent(MainActivity.this, OverlayService.class);
|
||||
//// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
//// getApplicationContext().startForegroundService(serviceIntent);
|
||||
//// } else {
|
||||
//// getApplicationContext().startService(serviceIntent);
|
||||
//// }
|
||||
//
|
||||
// /* Intent serviceIntent = new Intent(MainActivity.this, OverlayService.class);
|
||||
// startService(serviceIntent);*/
|
||||
//
|
||||
// /* } else {
|
||||
// stopService(new Intent(MainActivity.this, OverlayService.class));
|
||||
// }*/
|
||||
|
||||
});
|
||||
|
||||
findViewById(R.id.done_btn).setOnClickListener(v -> {
|
||||
onBackPressed();
|
||||
});
|
||||
|
||||
findViewById(R.id.back_btn).setOnClickListener(v -> {
|
||||
onBackPressed();
|
||||
});
|
||||
}
|
||||
|
||||
private int getPosition(AppList appList) {
|
||||
for (int i = 0; i < whiteList.size(); i++) {
|
||||
if (whiteList.get(i).getPackages().equals(appList.getPackages())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
private boolean isContainsWhiteList(AppList appList) {
|
||||
for (AppList appList1 : whiteList) {
|
||||
if (appList.getPackages().equals(appList1.getPackages())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<AppList> getWhiteListApps() {
|
||||
ArrayList<AppList> appsList = new ArrayList<>();
|
||||
|
||||
List<AppList> totalList = getInstalledApps();
|
||||
|
||||
for (AppList list : totalList) {
|
||||
if (!isSelectedApp(list.getPackages())) {
|
||||
appsList.add(list);
|
||||
}
|
||||
}
|
||||
|
||||
return appsList;
|
||||
}
|
||||
|
||||
public boolean isSelectedApp(String packageName) {
|
||||
if (mySharedPref.checkKey("APP_LIST")) {
|
||||
ArrayList<String> myList = new ArrayList<>(mySharedPref.getArrayList("APP_LIST"));
|
||||
return myList.contains(packageName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
swBlock.setChecked(isAccessibilityAppBlockingEnabled());
|
||||
}
|
||||
|
||||
private List<AppList> getInstalledApps() {
|
||||
if (installed_app_list != null) return installed_app_list;
|
||||
|
||||
PackageManager packageManager = getPackageManager();
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
|
||||
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, 0);
|
||||
ArrayList<String> appsName = new ArrayList<>();
|
||||
List<AppList> apps = new ArrayList<>();
|
||||
|
||||
// Iterate over the resolved apps and extract their names
|
||||
for (ResolveInfo resolveInfo : resolveInfoList) {
|
||||
String appName1 = resolveInfo.loadLabel(packageManager).toString();
|
||||
Drawable icon = resolveInfo.loadIcon(packageManager);
|
||||
String packages = resolveInfo.activityInfo.packageName;
|
||||
apps.add(new AppList(appName1, icon, packages));
|
||||
appsName.add(packages);
|
||||
}
|
||||
|
||||
Collections.sort(apps, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName()));
|
||||
Collections.sort(appsName);
|
||||
|
||||
if (mySharedPref.checkKey("APP_LIST")) {
|
||||
if (mySharedPref.getArrayList("APP_LIST").size() == 0) {
|
||||
mySharedPref.setArrayList("APP_LIST", appsName);
|
||||
}
|
||||
} else {
|
||||
mySharedPref.setArrayList("APP_LIST", appsName);
|
||||
}
|
||||
|
||||
return installed_app_list = apps;
|
||||
}
|
||||
|
||||
private boolean isAccessibilityAppBlockingEnabled() {
|
||||
int accessibilityEnabled = 0;
|
||||
final String service = getPackageName() + "/" + TopAppDetectionService.class.getCanonicalName();
|
||||
|
||||
try {
|
||||
accessibilityEnabled = Settings.Secure.getInt(
|
||||
getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_ENABLED);
|
||||
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
Log.e("TAG", "Error finding setting, default accessibility to not found: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
|
||||
TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
|
||||
|
||||
if (accessibilityEnabled == 1) {
|
||||
String settingValue = Settings.Secure.getString(
|
||||
getContentResolver(),
|
||||
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
|
||||
if (settingValue != null) {
|
||||
colonSplitter.setString(settingValue);
|
||||
while (colonSplitter.hasNext()) {
|
||||
String accessibilityService = colonSplitter.next();
|
||||
if (accessibilityService.equalsIgnoreCase(service)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isSystemPackage(PackageInfo pkgInfo) {
|
||||
return (pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||
}
|
||||
|
||||
private void openAccessibilityDialog() {
|
||||
|
||||
AppUtil.showAlert(this,
|
||||
"Accessibility Permission Dialog",
|
||||
"Please allow app blocking accessibility.",
|
||||
"Yes", (dialog, id) -> {
|
||||
Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||
startActivity(accessibilityIntent);
|
||||
},
|
||||
"No",(dialog, id) -> {
|
||||
// Action for 'NO' Button
|
||||
dialog.cancel();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyAppsAdapter extends RecyclerView.Adapter<MyAppsAdapter.ViewHolder> {
|
||||
private List<AppList> listdata;
|
||||
private Context context;
|
||||
private MySharedPref mySharedPref;
|
||||
boolean isWhiteList;
|
||||
ItemClicked itemClicked;
|
||||
|
||||
// RecyclerView recyclerView;
|
||||
public MyAppsAdapter(Context context, List<AppList> listdata, boolean isWhiteList, ItemClicked itemClicked) {
|
||||
this.context = context;
|
||||
this.listdata = listdata;
|
||||
this.isWhiteList = isWhiteList;
|
||||
this.itemClicked = itemClicked;
|
||||
mySharedPref = new MySharedPref(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from(parent.getContext());
|
||||
View listItem = layoutInflater.inflate(R.layout.app_list_item, parent, false);
|
||||
ViewHolder viewHolder = new ViewHolder(listItem);
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
holder.tvAppName.setText(listdata.get(position).getName());
|
||||
holder.ivAppIcon.setImageDrawable(listdata.get(position).getIcon());
|
||||
|
||||
if (!isSelectedApp(listdata.get(position).getPackages())) {
|
||||
holder.ivAddRemove.setImageResource(R.drawable.minus);
|
||||
} else {
|
||||
holder.ivAddRemove.setImageResource(R.drawable.plus);
|
||||
}
|
||||
|
||||
if (isWhiteList) {
|
||||
holder.ivAddRemove.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.ivAddRemove.setOnClickListener(v -> {
|
||||
|
||||
if (!isAccessibilityAppBlockingEnabled()) {
|
||||
openAccessibilityDialog();
|
||||
} else {
|
||||
addAppsInList(listdata.get(position).getPackages());
|
||||
|
||||
if (!isSelectedApp(listdata.get(position).getPackages())) {
|
||||
holder.ivAddRemove.setImageResource(R.drawable.minus);
|
||||
} else {
|
||||
holder.ivAddRemove.setImageResource(R.drawable.plus);
|
||||
}
|
||||
|
||||
itemClicked.onCLick(listdata.get(position));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public boolean isSelectedApp(String packageName) {
|
||||
if (mySharedPref.checkKey("APP_LIST")) {
|
||||
ArrayList<String> myList = new ArrayList<>(mySharedPref.getArrayList("APP_LIST"));
|
||||
return myList.contains(packageName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addAppsInList(String packageName) {
|
||||
ArrayList<String> myList = new ArrayList<>();
|
||||
|
||||
if (mySharedPref.checkKey("APP_LIST")) {
|
||||
|
||||
myList.addAll(mySharedPref.getArrayList("APP_LIST"));
|
||||
|
||||
if (myList.contains(packageName)) {
|
||||
myList.remove(packageName);
|
||||
mySharedPref.setArrayList("APP_LIST", myList);
|
||||
} else {
|
||||
myList.add(packageName);
|
||||
mySharedPref.setArrayList("APP_LIST", myList);
|
||||
}
|
||||
} else {
|
||||
myList.add(packageName);
|
||||
mySharedPref.setArrayList("APP_LIST", myList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return listdata.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
interface ItemClicked {
|
||||
void onCLick(AppList appList);
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public TextView tvAppName;
|
||||
public ImageView ivAppIcon, ivAddRemove;
|
||||
public SwitchCompat swOnOff;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
this.tvAppName = (TextView) itemView.findViewById(R.id.tvAppName);
|
||||
this.ivAppIcon = (ImageView) itemView.findViewById(R.id.iv_app_icon);
|
||||
this.ivAddRemove = (ImageView) itemView.findViewById(R.id.iv_add_remove);
|
||||
// this.swOnOff = (SwitchCompat) itemView.findViewById(R.id.swOnOff);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAccessibilityAppBlockingEnabled() {
|
||||
int accessibilityEnabled = 0;
|
||||
final String service = context.getPackageName() + "/" + TopAppDetectionService.class.getCanonicalName();
|
||||
|
||||
try {
|
||||
accessibilityEnabled = Settings.Secure.getInt(
|
||||
context.getContentResolver(),
|
||||
Settings.Secure.ACCESSIBILITY_ENABLED);
|
||||
|
||||
} catch (Settings.SettingNotFoundException e) {
|
||||
Log.e("TAG", "Error finding setting, default accessibility to not found: "
|
||||
+ e.getMessage());
|
||||
}
|
||||
|
||||
TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(':');
|
||||
|
||||
if (accessibilityEnabled == 1) {
|
||||
String settingValue = Settings.Secure.getString(
|
||||
context.getContentResolver(),
|
||||
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
|
||||
if (settingValue != null) {
|
||||
colonSplitter.setString(settingValue);
|
||||
while (colonSplitter.hasNext()) {
|
||||
String accessibilityService = colonSplitter.next();
|
||||
if (accessibilityService.equalsIgnoreCase(service)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void openAccessibilityDialog() {
|
||||
|
||||
AppUtil.showAlert(context,
|
||||
"Accessibility Permission Dialog",
|
||||
"Please allow app blocking accessibility.",
|
||||
"Yes", (dialog, id) -> {
|
||||
Intent accessibilityIntent = new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
|
||||
context.startActivity(accessibilityIntent);
|
||||
},
|
||||
"No",(dialog, id) -> {
|
||||
// Action for 'NO' Button
|
||||
dialog.cancel();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class MySharedPref {
|
||||
private static final String APP_SHARED_PREFS = "AppBlock";
|
||||
private SharedPreferences appSharedPrefs;
|
||||
private SharedPreferences.Editor prefsEditor;
|
||||
|
||||
public MySharedPref(Context activity) {
|
||||
this.appSharedPrefs = activity.getSharedPreferences(APP_SHARED_PREFS,
|
||||
Activity.MODE_PRIVATE);
|
||||
this.prefsEditor = appSharedPrefs.edit();
|
||||
}
|
||||
|
||||
public String getPrefsValue(String value) {
|
||||
return appSharedPrefs.getString(value, "");
|
||||
}
|
||||
|
||||
public void savePrefsValue(String key, String Value) {
|
||||
prefsEditor.putString(key, Value);
|
||||
prefsEditor.commit();
|
||||
}
|
||||
|
||||
public String getString(String value) {
|
||||
return appSharedPrefs.getString(value, "");
|
||||
}
|
||||
|
||||
public void saveString(String key, String Value) {
|
||||
prefsEditor.putString(key, Value);
|
||||
prefsEditor.commit();
|
||||
}
|
||||
|
||||
public Boolean checkKey(String Key) {
|
||||
if (appSharedPrefs.contains(Key))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<String> getArrayList(String key) {
|
||||
return appSharedPrefs.getStringSet(key, null);
|
||||
}
|
||||
|
||||
public void setArrayList(String key, ArrayList<String> list) {
|
||||
Set<String> set = new HashSet<>(list);
|
||||
prefsEditor.putStringSet(key, set);
|
||||
prefsEditor.commit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.ssb.simplitend.appblocking;
|
||||
|
||||
import android.accessibilityservice.AccessibilityService;
|
||||
import android.accessibilityservice.AccessibilityServiceInfo;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
|
||||
import com.ssb.simplitend.BuildConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TopAppDetectionService extends AccessibilityService {
|
||||
MySharedPref sharedPref;
|
||||
List<String> appsList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
||||
|
||||
Log.d("aditya", "onAccessibilityEvent: " + event);
|
||||
|
||||
sharedPref = new MySharedPref(getApplication());
|
||||
appsList.addAll(sharedPref.getArrayList("APP_LIST"));
|
||||
|
||||
Log.i("TAG--->", "onAccessibilityEvent: ==>" + sharedPref.getArrayList("APP_LIST"));
|
||||
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
// Get the package name of the currently opened app
|
||||
String packageName = event.getPackageName().toString();
|
||||
|
||||
Log.i("TAG--->", "onAccessibilityEvent: 1==>" + packageName);
|
||||
|
||||
if (sharedPref.checkKey("APP_LIST") &&
|
||||
!packageName.equals(BuildConfig.APPLICATION_ID) &&
|
||||
!packageName.equals("com.android.settings") &&
|
||||
!packageName.equals("com.google.android.googlequicksearchbox")) {
|
||||
|
||||
if (sharedPref.getArrayList("APP_LIST").contains(packageName)) {
|
||||
Intent intent = new Intent(this, BlockApp.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
// // Check if the package name matches the blocked app
|
||||
// for (String packageNames : appsList) {
|
||||
// if (packageNames.equals(packageName)) {
|
||||
// // Launch the parent app or show a blocking message
|
||||
// Intent intent = new Intent(this, BlockApp.class);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInterrupt() {
|
||||
// This method is required but not used in this example
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onServiceConnected() {
|
||||
super.onServiceConnected();
|
||||
|
||||
sharedPref = new MySharedPref(getApplication());
|
||||
// Set the event types and package names to monitor
|
||||
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
|
||||
info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
||||
info.packageNames = sharedPref.getArrayList("APP_LIST").toArray(new String[0]);
|
||||
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
|
||||
|
||||
// Set the flags based on the Android version
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
info.flags = AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS |
|
||||
AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS;
|
||||
}
|
||||
|
||||
// Set the service info
|
||||
setServiceInfo(info);
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public void onTaskRemoved(Intent rootIntent) {
|
||||
Intent restartServiceIntent = new Intent(getApplicationContext(), this.getClass());
|
||||
restartServiceIntent.setPackage(getPackageName());
|
||||
startService(restartServiceIntent);
|
||||
super.onTaskRemoved(rootIntent);
|
||||
}*/
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import androidx.lifecycle.ViewModelProvider;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.CaregiverDataCache;
|
||||
import com.ssb.simplitend.articles.ArticlesActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.CaregiverChatsFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.CgDashBoardFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.fragments.MyPatientFragment;
|
||||
import com.ssb.simplitend.caregiverdashboard.mvvm.CaregiverMainViewModel;
|
||||
@@ -22,6 +21,7 @@ import com.ssb.simplitend.customsviews.MenuItem;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardActivityBinding;
|
||||
import com.ssb.simplitend.databinding.CaregiverDashboardMenuBinding;
|
||||
import com.ssb.simplitend.faqs.FAQ_Activity;
|
||||
import com.ssb.simplitend.patient_dashboard.chats.ChatFragment;
|
||||
import com.ssb.simplitend.welcome.welcomecg.mvvm.CareGiverData;
|
||||
import com.yarolegovich.slidingrootnav.SlidingRootNavBuilder;
|
||||
import com.yarolegovich.slidingrootnav.callback.DragStateListener;
|
||||
@@ -56,6 +56,21 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
Fragment fragment = getSupportFragmentManager().findFragmentByTag("chat");
|
||||
if (fragment != null){
|
||||
if (fragment instanceof ChatFragment){
|
||||
binding.bottomNav.selectMenuItem(MenuItem.DASHBOARD);
|
||||
onBottomNavItemSelected(MenuItem.DASHBOARD);
|
||||
}else{
|
||||
super.onBackPressed();
|
||||
}
|
||||
}else{
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
|
||||
// viewmodel
|
||||
@@ -77,7 +92,7 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
binding.bottomNav.setItemSelectListener(this);
|
||||
|
||||
// initializing dashboard fragment
|
||||
replaceFragment(new CgDashBoardFragment());
|
||||
replaceFragment(new CgDashBoardFragment(), "dashboard");
|
||||
|
||||
setLayoutDetails();
|
||||
|
||||
@@ -147,9 +162,9 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
menuBinding.name.setText(careGiverData.patientDetails.first_name);
|
||||
}
|
||||
|
||||
private void replaceFragment(Fragment fragment){
|
||||
private void replaceFragment(Fragment fragment, String tag){
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_cg_home, fragment)
|
||||
.replace(R.id.fcv_cg_home, fragment, tag)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@@ -173,9 +188,12 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
@Override
|
||||
public void onBottomNavItemSelected(MenuItem selectedItem) {
|
||||
if (selectedItem == MenuItem.DASHBOARD){
|
||||
replaceFragment(new CgDashBoardFragment());
|
||||
replaceFragment(new CgDashBoardFragment(), "dashboard");
|
||||
|
||||
// setting up toolbar accordingly
|
||||
binding.toolbar.setVisibility(View.VISIBLE);
|
||||
binding.bottomNav.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
|
||||
binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.black));
|
||||
|
||||
@@ -190,17 +208,20 @@ public class CaregiverDashActivity extends AppCompatActivity implements
|
||||
binding.toolbar.setTitle("Welcome " + first_name);
|
||||
|
||||
}else if (selectedItem == MenuItem.MY_PATIENT){
|
||||
replaceFragment(new MyPatientFragment());
|
||||
replaceFragment(new MyPatientFragment(), "my_patient");
|
||||
|
||||
// setting up toolbar accordingly
|
||||
binding.toolbar.setVisibility(View.VISIBLE);
|
||||
binding.bottomNav.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.toolbar.setTitle(null);
|
||||
binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
|
||||
binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.white));
|
||||
}else if (selectedItem == MenuItem.CHATS){
|
||||
replaceFragment(new CaregiverChatsFragment());
|
||||
binding.toolbar.setNavigationIcon(AppCompatResources.getDrawable(this, R.drawable.ic_menu));
|
||||
binding.toolbar.setNavigationIconTint(getResources().getColor(R.color.black));
|
||||
binding.toolbar.setTitle("Chats");
|
||||
replaceFragment(new ChatFragment(), "chat");
|
||||
|
||||
binding.toolbar.setVisibility(View.GONE);
|
||||
binding.bottomNav.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.ssb.simplitend.caregiverdashboard.activities;
|
||||
|
||||
import static androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG;
|
||||
import static com.ssb.simplitend.caregiverdashboard.activities.EditProfileInfoActivity.IS_CAREGIVER;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.biometric.BiometricManager;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -70,9 +73,27 @@ public class CaregiverProfileActivity extends AppCompatActivity implements Compo
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
checkIfBiometricAvailable();
|
||||
|
||||
binding.biometricCheck.setOnCheckedChangeListener(this);
|
||||
}
|
||||
|
||||
private void checkIfBiometricAvailable() {
|
||||
|
||||
BiometricManager biometricManager = BiometricManager.from(this);
|
||||
|
||||
switch (biometricManager.canAuthenticate(BIOMETRIC_STRONG)) {
|
||||
case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE:
|
||||
case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE:
|
||||
binding.biometricCheckView.setVisibility(View.GONE);
|
||||
break;
|
||||
case BiometricManager.BIOMETRIC_SUCCESS:
|
||||
case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED:
|
||||
binding.biometricCheckView.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void clickEvents() {
|
||||
binding.backBtn.setOnClickListener(v -> onBackPressed());
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.ssb.simplitend.caregiverdashboard.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.ssb.simplitend.databinding.CaregiverChatsFragmentBinding;
|
||||
|
||||
public class CaregiverChatsFragment extends Fragment {
|
||||
|
||||
// view binding
|
||||
protected CaregiverChatsFragmentBinding binding;
|
||||
|
||||
public CaregiverChatsFragment(){
|
||||
// required empty
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = CaregiverChatsFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
return binding.getRoot();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import static com.ssb.simplitend.caregiverdashboard.activities.PatientProfileSho
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -37,6 +38,8 @@ public class MyPatientFragment extends Fragment {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = MyPatientFragmentBinding.inflate(inflater, container, false);
|
||||
|
||||
adjustLayout();
|
||||
|
||||
initViews();
|
||||
|
||||
clickEvents();
|
||||
@@ -44,6 +47,20 @@ public class MyPatientFragment extends Fragment {
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
// adjusts the guideline percentage w.r.t the aspect ratio of the screen
|
||||
private void adjustLayout() {
|
||||
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
int screenWidth = displayMetrics.widthPixels;
|
||||
int screenHeight = displayMetrics.heightPixels;
|
||||
|
||||
// Calculate aspect ratio
|
||||
float aspectRatio = (float) screenHeight / (float) screenWidth;
|
||||
|
||||
if (aspectRatio < 2.03f){
|
||||
binding.guideline.setGuidelinePercent(0.55f);
|
||||
}
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
CaregiverDataCache.getCaregiverData(requireContext(), (careGiverData1 -> {
|
||||
this.careGiverData = careGiverData1;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class HomeBottomNav extends FrameLayout {
|
||||
this.itemSelectListener = itemSelectListener;
|
||||
}
|
||||
|
||||
private void selectMenuItem(MenuItem menuitem){
|
||||
public void selectMenuItem(MenuItem menuitem){
|
||||
|
||||
clearItemSelection(this.selected_item);
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ public class ChatFragment extends Fragment {
|
||||
// view binding
|
||||
protected ChatFragmentBinding binding;
|
||||
|
||||
// chat item
|
||||
private ChatItem chatItem;
|
||||
public static final String CHAT_ITEM_KEY = "chat_item_key";
|
||||
|
||||
private MessagesListAdapter<Message> messageAdapter;
|
||||
@@ -64,21 +62,7 @@ public class ChatFragment extends Fragment {
|
||||
|
||||
private void initViews() {
|
||||
|
||||
Bundle bundle = getArguments();
|
||||
|
||||
if (bundle == null) {
|
||||
Toast.makeText(requireActivity(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
chatItem = (ChatItem) bundle.getSerializable(CHAT_ITEM_KEY);
|
||||
|
||||
if (chatItem == null) {
|
||||
Toast.makeText(requireActivity(), "Something went wrong", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
binding.chatTitle.setText(chatItem.name);
|
||||
binding.chatTitle.setText("Aditya");
|
||||
|
||||
MessagesListAdapter.HoldersConfig holdersConfig = new MessagesListAdapter.HoldersConfig();
|
||||
holdersConfig.setOutcomingLayout(R.layout.sender_msg_viewholder);
|
||||
@@ -97,7 +81,5 @@ public class ChatFragment extends Fragment {
|
||||
messageAdapter.addToStart(new Message(new Receiver(), "Good morning mate!"), true);
|
||||
messageAdapter.addToStart(new Message(new Author(), "Good morning"), true);
|
||||
messageAdapter.addToStart(new Message(new Receiver(), "Good morning mate!"), true);
|
||||
|
||||
messageAdapter.addToStart(new Message(new Receiver(), chatItem.last_message), true);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.appblocking.FUAActivity;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.PatientDataCache;
|
||||
import com.ssb.simplitend.databinding.PatientDashboardFragmentBinding;
|
||||
@@ -124,6 +125,11 @@ public class PatientDashboardFragment extends Fragment {
|
||||
binding.profile.setOnClickListener(v -> {
|
||||
Navigation.findNavController(v).navigate(R.id.action_CPDashboardFragment_to_patientProfileInfoFragment);
|
||||
});
|
||||
|
||||
binding.apps.setOnClickListener(v -> {
|
||||
Intent intent = new Intent(requireActivity(), FUAActivity.class);
|
||||
startActivity(intent);
|
||||
});
|
||||
}
|
||||
|
||||
private void updateTime() {
|
||||
|
||||
@@ -18,13 +18,9 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.ssb.simplitend.R;
|
||||
import com.ssb.simplitend.apputils.AppUtil;
|
||||
import com.ssb.simplitend.apputils.PatientDataCache;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.EditProfileInfoActivity;
|
||||
import com.ssb.simplitend.caregiverdashboard.activities.PatientProfileShowerActivity;
|
||||
import com.ssb.simplitend.cg_geofencing.CgGeoFencingActivity;
|
||||
import com.ssb.simplitend.databinding.ActivityPatProfileInfoBinding;
|
||||
import com.ssb.simplitend.welcome.welcomepatient.mvvm.models.PatientData;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
ProfileContracts.GetRemindersListCallback, ProfileContracts.ReminderDeleteCallback,
|
||||
ProfileContracts.AddReminderCallBack,
|
||||
ReminderAdapter.ReminderCheckClickListener,
|
||||
ReminderAdapter.ReminderClickListener{
|
||||
ReminderAdapter.ReminderClickListener {
|
||||
|
||||
// view binding
|
||||
protected RemindersFragmentBinding binding;
|
||||
@@ -104,34 +104,34 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
|
||||
// add button
|
||||
binding.addReminder.setOnClickListener(v ->
|
||||
{
|
||||
{
|
||||
|
||||
try {
|
||||
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment);
|
||||
}catch (Exception e){
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
try {
|
||||
Navigation.findNavController(v).navigate(R.id.action_reminderFragment_to_addReminderFragment);
|
||||
} catch (Exception e) {
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
try {
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddReminderFragment.class, null)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
} catch (Exception ex) {
|
||||
// user may be out of context
|
||||
try {
|
||||
getParentFragmentManager().beginTransaction()
|
||||
.replace(R.id.fcv_profile_shower, AddReminderFragment.class, null)
|
||||
.addToBackStack("add_reminder")
|
||||
.commitAllowingStateLoss();
|
||||
} catch (Exception ex) {
|
||||
// user may be out of context
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
@@ -426,7 +426,7 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
try {
|
||||
Navigation.findNavController(binding.getRoot())
|
||||
.navigate(R.id.action_reminderFragment_to_addReminderFragment, bundle);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
@@ -463,37 +463,35 @@ public class ReminderFragment extends Fragment implements RecyclerTouchListener.
|
||||
@Override
|
||||
public void onCheck(ReminderResult reminderResult, int position) {
|
||||
// is user checking only today's check
|
||||
try {
|
||||
int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||
int selected_date = Integer.parseInt(weekDayViewsList.get(reminderViewModel.selected_dow).date.getText().toString());
|
||||
|
||||
if (reminderResult.reminder_marked == null) {
|
||||
/*
|
||||
now, we don't want to allow checking of routine of other day
|
||||
*/
|
||||
try {
|
||||
int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||
int selected_date = Integer.parseInt(weekDayViewsList.get(reminderViewModel.selected_dow).date.getText().toString());
|
||||
|
||||
if (today_date == selected_date) {
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Are you sure?",
|
||||
"Do yuo want to check this reminder?\nThis cannot be undone.",
|
||||
getString(R.string.yes),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
|
||||
updateRoutine(reminderResult, position);
|
||||
|
||||
}, getString(R.string.no),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
if (today_date == selected_date) {
|
||||
if (reminderResult.reminder_marked != null){
|
||||
// already marked
|
||||
return;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Are you sure?",
|
||||
"Do yuo want to check this reminder?\nThis cannot be undone.",
|
||||
getString(R.string.yes),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
|
||||
updateRoutine(reminderResult, position);
|
||||
|
||||
}, getString(R.string.no),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
ProfileContracts.AddNUpdateRoutineCallback {
|
||||
|
||||
private static final String TAG = "RoutineFragment";
|
||||
|
||||
|
||||
// view binding
|
||||
protected RoutineFragmentBinding binding;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
public RoutineFragment(){
|
||||
public RoutineFragment() {
|
||||
// required empty const.
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
});
|
||||
|
||||
binding.backBtn.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
@@ -112,7 +112,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
try {
|
||||
|
||||
Navigation.findNavController(v).navigate(R.id.action_routineFragment_to_addRoutineFragment);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
@@ -128,7 +128,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
});
|
||||
|
||||
binding.done.setOnClickListener(v -> {
|
||||
if (getActivity() != null){
|
||||
if (getActivity() != null) {
|
||||
getActivity().onBackPressed();
|
||||
}
|
||||
});
|
||||
@@ -201,7 +201,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
for (int i = 0; i<7; i++){
|
||||
for (int i = 0; i < 7; i++) {
|
||||
WeekDayViewHolder dayViewHolder = weekDayViewsList.get(i);
|
||||
|
||||
dayViewHolder.day_of_week = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
@@ -213,14 +213,14 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
}
|
||||
}
|
||||
|
||||
private void setDayOfWeek(int selection){
|
||||
private void setDayOfWeek(int selection) {
|
||||
|
||||
// setting selected date in adapter
|
||||
routineAdapter.setSelected_date(weekDayViewsList.get(selection).mDate);
|
||||
|
||||
clearSelection();
|
||||
|
||||
switch (routineViewModel.selected_dow = selection){
|
||||
switch (routineViewModel.selected_dow = selection) {
|
||||
case 0:
|
||||
binding.day.setBackgroundResource(R.drawable.seleted_item_primary);
|
||||
binding.dayT1.setTextColor(getResources().getColor(R.color.white_bg));
|
||||
@@ -266,8 +266,8 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
}
|
||||
|
||||
private void clearSelection(){
|
||||
switch (routineViewModel.selected_dow){
|
||||
private void clearSelection() {
|
||||
switch (routineViewModel.selected_dow) {
|
||||
case 0:
|
||||
binding.day.setBackgroundColor(getResources().getColor(R.color.white_bg));
|
||||
binding.dayT1.setTextColor(getResources().getColor(R.color.black));
|
||||
@@ -340,13 +340,13 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
public void onRoutinesFetched(List<RoutineDetails> routineList) {
|
||||
progressDialog.dismiss();
|
||||
|
||||
if (routineList != null && routineList.size() > 0){
|
||||
if (routineList != null && routineList.size() > 0) {
|
||||
// reminders are present
|
||||
binding.routineRv.setVisibility(View.VISIBLE);
|
||||
binding.noData.setVisibility(View.GONE);
|
||||
|
||||
routineAdapter.submitList(routineList);
|
||||
}else{
|
||||
} else {
|
||||
binding.routineRv.setVisibility(View.GONE);
|
||||
binding.noData.setVisibility(View.VISIBLE);
|
||||
}
|
||||
@@ -372,7 +372,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
AppUtil.showSOSDecision(requireContext(), getString(R.string.delete_med_routine),
|
||||
getString(R.string.yes), getString(R.string.no),
|
||||
v1-> {
|
||||
v1 -> {
|
||||
// yes click
|
||||
progressDialog.setTitle("Please wait...");
|
||||
progressDialog.setMessage("while we delete the routine for you.");
|
||||
@@ -400,7 +400,7 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
|
||||
try {
|
||||
Navigation.findNavController(binding.getRoot()).navigate(R.id.action_routineFragment_to_addRoutineFragment, bundle);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
// there may be a IllegalStateException as this same fragment is used from another fragment
|
||||
// and not through the nav graph
|
||||
|
||||
@@ -418,37 +418,38 @@ public class RoutineFragment extends Fragment implements RoutineAdapter.ClickLis
|
||||
@Override
|
||||
public void onCheckClick(RoutineDetails routineDetails, int position) {
|
||||
// is user checking only today's check
|
||||
|
||||
if (routineDetails.routine_marked == null){
|
||||
/*
|
||||
now, we don't want to allow checking of routine of other day
|
||||
*/
|
||||
try {
|
||||
int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||
int selected_date = Integer.parseInt(weekDayViewsList.get(routineViewModel.selected_dow).date.getText().toString());
|
||||
try {
|
||||
int today_date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
|
||||
int selected_date = Integer.parseInt(weekDayViewsList.get(routineViewModel.selected_dow).date.getText().toString());
|
||||
|
||||
if (today_date == selected_date){
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Are you sure?",
|
||||
"Do yuo want to check this routine?\nThis cannot be undone.",
|
||||
getString(R.string.yes),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
|
||||
updateRoutine(routineDetails, position);
|
||||
|
||||
}, getString(R.string.no),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
}else{
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
if (today_date == selected_date) {
|
||||
if (routineDetails.routine_marked != null){
|
||||
// already marked
|
||||
return;
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
|
||||
AppUtil.showAlert(requireContext(),
|
||||
"Are you sure?",
|
||||
"Do yuo want to check this routine?\nThis cannot be undone.",
|
||||
getString(R.string.yes),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
|
||||
updateRoutine(routineDetails, position);
|
||||
|
||||
}, getString(R.string.no),
|
||||
(dialog, which) -> {
|
||||
dialog.dismiss();
|
||||
});
|
||||
} else {
|
||||
Toast.makeText(requireContext(), "Cannot mark future routine.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(requireContext(), "Couldn't be done.", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -223,10 +223,14 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
}
|
||||
|
||||
if (patientData.lat != null && patientData.lng != null) {
|
||||
double lat = Double.parseDouble(patientData.lat);
|
||||
double lng = Double.parseDouble(patientData.lng);
|
||||
try {
|
||||
double lat = Double.parseDouble(patientData.lat);
|
||||
double lng = Double.parseDouble(patientData.lng);
|
||||
|
||||
currentLocation = new LatLng(lat, lng);
|
||||
currentLocation = new LatLng(lat, lng);
|
||||
} catch (NumberFormatException e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
if (patientData.address_line1 != null) {
|
||||
@@ -389,6 +393,7 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
googleMap.setMyLocationEnabled(true);
|
||||
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||
}
|
||||
|
||||
requestLocations();
|
||||
}
|
||||
}
|
||||
@@ -409,8 +414,6 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
|
||||
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(default_map_pos));
|
||||
|
||||
addMarker(currentLocation, "Current location");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -422,12 +425,13 @@ public class LocationFragment extends Fragment implements OnMapReadyCallback,
|
||||
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
|
||||
}
|
||||
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.75796541422796, -73.98557368665934), 14));
|
||||
|
||||
googleMap.setOnMapClickListener(this);
|
||||
|
||||
if (currentLocation != null) {
|
||||
addMarker(currentLocation, "Selected location");
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLocation, 14));
|
||||
}else{
|
||||
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(40.75796541422796, -73.98557368665934), 14));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
app/src/main/res/drawable/minus.png
Normal file
BIN
app/src/main/res/drawable/minus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable/plus.png
Normal file
BIN
app/src/main/res/drawable/plus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
8
app/src/main/res/drawable/ractangle_corner_10.xml
Normal file
8
app/src/main/res/drawable/ractangle_corner_10.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
8
app/src/main/res/drawable/round.xml
Normal file
8
app/src/main/res/drawable/round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -355,7 +355,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/caregiver_check_view"
|
||||
android:id="@+id/biometric_check_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
|
||||
135
app/src/main/res/layout/activity_fua.xml
Normal file
135
app/src/main/res/layout/activity_fua.xml
Normal file
@@ -0,0 +1,135 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".appblocking.FUAActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_btn"
|
||||
android:layout_width="35sp"
|
||||
android:layout_height="35sp"
|
||||
android:layout_margin="15dp"
|
||||
android:contentDescription="@string/back_button"
|
||||
android:padding="5dp"
|
||||
android:paddingStart="-15dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:src="@drawable/arrow_back" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/frequently_used_apps"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
|
||||
android:layout_below="@id/back_btn"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_above="@id/done_btn"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swBlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:checked="false"
|
||||
android:text="Block the app"
|
||||
android:textColor="@color/black"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/swBlock">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_white_apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:nestedScrollingEnabled="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_white_list" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:background="@color/black_10"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rv_white_apps" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/all_app_tile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/all_apps"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="20sp"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvApps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:nestedScrollingEnabled="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/done_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="25dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:backgroundTint="@color/color_primary"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="Done"
|
||||
android:textColor="@color/white"
|
||||
android:textAppearance="@style/TextAppearance.Material3.TitleMedium"
|
||||
android:textAllCaps="false"
|
||||
android:paddingVertical="15dp"
|
||||
app:cornerRadius="10dp"
|
||||
|
||||
android:layout_alignParentBottom="true"
|
||||
|
||||
/>
|
||||
|
||||
</RelativeLayout>
|
||||
84
app/src/main/res/layout/app_list_item.xml
Normal file
84
app/src/main/res/layout/app_list_item.xml
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/rlApps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/rlApps1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/white"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/cv_app_icon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:background="@drawable/ractangle_corner_10"
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="10dp"
|
||||
app:elevation="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_app_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginTop="7dp"
|
||||
android:layout_marginEnd="7dp"
|
||||
android:layout_marginBottom="7dp"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_add_remove"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:background="@drawable/round"
|
||||
android:src="@drawable/plus"
|
||||
android:layout_alignParentEnd="true"
|
||||
app:elevation="0dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:ems="5"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:text="Axis Bank"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cv_app_icon" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOnOff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:checked="false"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -3,9 +3,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:background="@color/white">
|
||||
|
||||
<!-- margin Bottom of 75dp above is important for the home appearance-->
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
android:id="@+id/fcv_cg_home"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@color/color_accent"
|
||||
android:layout_marginBottom="@dimen/bottom_nav_base_height"
|
||||
/>
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Akanksha surve"
|
||||
android:fontFamily="@font/nunito_medium"
|
||||
android:textAppearance="@style/TextAppearance.Material3.HeadlineMedium"
|
||||
android:textSize="@dimen/_18ssp"
|
||||
android:textColor="@color/black"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
@@ -43,10 +43,10 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/message_et"
|
||||
|
||||
app:incomingDefaultBubbleColor="@color/color_accent"
|
||||
app:incomingDefaultBubbleColor="#EEF5FC"
|
||||
app:incomingTextColor="@color/black"
|
||||
|
||||
app:outcomingDefaultBubbleColor="@color/color_primary"
|
||||
app:outcomingDefaultBubbleColor="#043E61"
|
||||
app:outcomingTextColor="@color/white_bg"
|
||||
app:outcomingTimeTextColor="@color/white"
|
||||
|
||||
|
||||
57
app/src/main/res/layout/list_item.xml
Normal file
57
app/src/main/res/layout/list_item.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlApps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="10dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_app_icon"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:src="@mipmap/ic_launcher"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAppName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@+id/swOnOff"
|
||||
android:layout_toEndOf="@id/iv_app_icon"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="50dp"
|
||||
android:padding="5dp"
|
||||
android:textColor="@color/black"
|
||||
android:text="App name"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOnOff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginHorizontal="5dp"
|
||||
android:checked="false" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:background="#1A000000"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rlApps" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,10 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_marginBottom="75dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white">
|
||||
|
||||
<!-- margin Bottom of 75dp above is important for the home appearance-->
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/relativeLayout3"
|
||||
android:layout_width="0dp"
|
||||
@@ -32,31 +35,27 @@
|
||||
|
||||
/>
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/profile_img"
|
||||
android:layout_width="@dimen/_80sdp"
|
||||
android:layout_height="@dimen/_80sdp"
|
||||
|
||||
android:layout_below="@id/title"
|
||||
|
||||
android:layout_centerInParent="true"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
android:contentDescription="@string/patient_profile"
|
||||
android:elevation="15dp"
|
||||
|
||||
android:src="@drawable/static_3"
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/profile_img"
|
||||
android:layout_below="@id/title"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="@dimen/_15sdp"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<de.hdodenhof.circleimageview.CircleImageView
|
||||
android:id="@+id/profile_img"
|
||||
android:layout_width="@dimen/_80sdp"
|
||||
android:layout_height="@dimen/_80sdp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
android:contentDescription="@string/patient_profile"
|
||||
|
||||
android:elevation="15dp"
|
||||
|
||||
android:src="@drawable/static_3" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
20
app/src/main/res/layout/overlay_layout.xml
Normal file
20
app/src/main/res/layout/overlay_layout.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="App blocked"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -349,6 +349,7 @@
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/apps"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
|
||||
@@ -15,22 +15,30 @@
|
||||
<item name="android:textColor">@color/black</item>
|
||||
<item name="android:textCursorDrawable">@drawable/primary_cursor_drawable</item>
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
|
||||
<!-- <item name="android:datePickerStyle">@style/myDatePickerStyle</item>-->
|
||||
|
||||
<!-- <item name="android:datePickerStyle">@style/myDatePickerStyle</item>-->
|
||||
|
||||
</style>
|
||||
|
||||
// top corner rounded bottom sheet
|
||||
|
||||
<style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
|
||||
<item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
|
||||
</style>
|
||||
|
||||
<style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
|
||||
// date picker dialog theme
|
||||
|
||||
<style name="myDatePickerStyle" parent="android:Widget.Material.DatePicker">
|
||||
<item name="android:datePickerMode">spinner</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<item name="android:background">@color/white</item>
|
||||
<item name="android:colorPrimary">@color/color_primary</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -17,4 +17,6 @@
|
||||
<color name="cg_dash_bg">#005F9A</color>
|
||||
<color name="pwd_bg">#545454</color>
|
||||
|
||||
<color name="black_10">#1A000000</color>
|
||||
|
||||
</resources>
|
||||
@@ -382,4 +382,9 @@
|
||||
<item>Miles</item>
|
||||
</string-array>
|
||||
|
||||
<!-- app blocking stuff-->
|
||||
<string name="accessibility_service_description">accessibility_service_description</string>
|
||||
<string name="default_notification_channel_id">ForegroundServiceChannel</string>
|
||||
<string name="all_apps">All apps</string>
|
||||
|
||||
</resources>
|
||||
@@ -14,6 +14,9 @@
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="android:textCursorDrawable">@drawable/primary_cursor_drawable</item>
|
||||
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||
|
||||
<!-- <item name="android:datePickerStyle">@style/myDatePickerStyle</item>-->
|
||||
|
||||
</style>
|
||||
|
||||
// top corner rounded bottom sheet
|
||||
@@ -24,4 +27,14 @@
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
// date picker dialog theme
|
||||
<style name="myDatePickerStyle" parent="android:Widget.Material.DatePicker">
|
||||
<item name="android:datePickerMode">spinner</item>
|
||||
</style>
|
||||
|
||||
<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog.Alert">
|
||||
<item name="android:background">@color/white</item>
|
||||
<item name="android:colorPrimary">@color/color_primary</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
8
app/src/main/res/xml/accessibility_service_config.xml
Normal file
8
app/src/main/res/xml/accessibility_service_config.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:accessibilityEventTypes="typeWindowStateChanged"
|
||||
android:accessibilityFlags="flagIncludeNotImportantViews|flagReportViewIds"
|
||||
android:canRetrieveWindowContent="true"
|
||||
android:description="@string/accessibility_service_description"
|
||||
android:packageNames="com.ssb.simplitend"
|
||||
android:settingsActivity="com.ssb.simplitend.appblocking.FUAActivity" />
|
||||
Reference in New Issue
Block a user