common functionality without profiles

This commit is contained in:
Nazar 2019-06-19 20:41:35 +03:00
parent 520e19de14
commit 1d5a33ed88
269 changed files with 1460 additions and 591 deletions

View file

@ -6,18 +6,23 @@
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".app.TurnScreenApp"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="net.osmand.turnScreenOn.PluginDescriptionActivity"></activity>
<activity android:name=".OsmandInstallActivity"
android:theme="@style/AppTheme.NoActionBar"></activity>
<activity
android:name="net.osmand.turnScreenOn.PermissionsSetUpActivity"
android:name=".PluginDescriptionActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name="net.osmand.turnScreenOn.MainActivity"
android:name=".PermissionsSetUpActivity"
android:theme="@style/AppTheme.NoActionBar" />
<activity
android:name=".MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -27,7 +32,7 @@
</activity>
<receiver
android:name="net.osmand.turnScreenOn.receiver.DeviceAdminRecv"
android:name=".receiver.DeviceAdminRecv"
android:label="@string/app_name"
android:permission="android.permission.BIND_DEVICE_ADMIN">
<meta-data

View file

@ -71,6 +71,8 @@ import net.osmand.aidl.navigation.NavigateSearchParams;
import net.osmand.aidl.customization.SetWidgetsParams;
import net.osmand.aidl.customization.OsmandSettingsParams;
import net.osmand.aidl.customization.CustomizationInfoParams;
import net.osmand.aidl.customization.OsmandSettingsInfoParams;
import net.osmand.aidl.gpx.AGpxFile;
import net.osmand.aidl.gpx.AGpxFileDetails;
@ -89,6 +91,7 @@ import net.osmand.aidl.contextmenu.UpdateContextMenuButtonsParams;
import net.osmand.aidl.contextmenu.RemoveContextMenuButtonsParams;
// NOTE: Add new methods at the end of file!!!
interface IOsmAndAidlInterface {
@ -239,14 +242,14 @@ interface IOsmAndAidlInterface {
* @param color (String) - color of gpx. Can be one of: "red", "orange", "lightblue", "blue", "purple",
* "translucent_red", "translucent_orange", "translucent_lightblue",
* "translucent_blue", "translucent_purple"
* @param show (boolean) - show track on the map after import
* @param showDialog (boolean) - showDialog track on the map after import
*/
boolean importGpx(in ImportGpxParams params);
/**
* Show GPX file on map.
*
* @param fileName (String) - file name to show. Must be imported first.
* @param fileName (String) - file name to showDialog. Must be imported first.
*/
boolean showGpx(in ShowGpxParams params);
@ -534,7 +537,7 @@ interface IOsmAndAidlInterface {
boolean setNavDrawerLogo(in String imageUri);
/**
* Method for selected UI elements (like QuickSearch button) to show.
* Method for selected UI elements (like QuickSearch button) to showDialog.
*
* @param ids (List<String>)- list of menu items keys from {@link OsmAndCustomizationConstants}
*/
@ -548,7 +551,7 @@ interface IOsmAndAidlInterface {
boolean setDisabledIds(in List<String> ids);
/**
* Method to show selected NavDrawer's menu items.
* Method to showDialog selected NavDrawer's menu items.
*
* @param patterns (List<String>) - list of menu items names from {@link OsmAndCustomizationConstants}
*/
@ -607,7 +610,7 @@ interface IOsmAndAidlInterface {
boolean getActiveSqliteDbFiles(out List<ASqliteDbFile> files);
/**
* Method to show selected sqlitedb file as map overlay.
* Method to showDialog selected sqlitedb file as map overlay.
*
* @param fileName (String) - name of sqlitedb file
*/
@ -701,5 +704,8 @@ interface IOsmAndAidlInterface {
boolean removeContextMenuButtons(in RemoveContextMenuButtonsParams params);
boolean updateContextMenuButtons(in UpdateContextMenuButtonsParams params);
boolean areOsmandSettingsCustomized(in OsmandSettingsInfoParams params);
boolean setCustomization(in CustomizationInfoParams params);
long registerForVoiceRouterMessages(in ANavigationVoiceRouterMessageParams params, IOsmAndAidlCallback callback);
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.customization;
parcelable CustomizationInfoParams;

View file

@ -0,0 +1,172 @@
package net.osmand.aidl.customization;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import net.osmand.aidl.navdrawer.NavDrawerFooterParams;
import net.osmand.aidl.navdrawer.NavDrawerHeaderParams;
import net.osmand.aidl.navdrawer.SetNavDrawerItemsParams;
import net.osmand.aidl.plugins.PluginParams;
import java.util.ArrayList;
import java.util.List;
public class CustomizationInfoParams implements Parcelable {
private OsmandSettingsParams settingsParams;
private NavDrawerHeaderParams navDrawerHeaderParams;
private NavDrawerFooterParams navDrawerFooterParams;
private SetNavDrawerItemsParams navDrawerItemsParams;
private ArrayList<SetWidgetsParams> visibilityWidgetsParams = new ArrayList<>();
private ArrayList<SetWidgetsParams> availabilityWidgetsParams = new ArrayList<>();
private ArrayList<PluginParams> pluginsParams = new ArrayList<>();
private List<String> featuresEnabledIds = new ArrayList<>();
private List<String> featuresDisabledIds = new ArrayList<>();
private List<String> featuresEnabledPatterns = new ArrayList<>();
private List<String> featuresDisabledPatterns = new ArrayList<>();
public CustomizationInfoParams(OsmandSettingsParams settingsParams,
NavDrawerHeaderParams navDrawerHeaderParams,
NavDrawerFooterParams navDrawerFooterParams,
SetNavDrawerItemsParams navDrawerItemsParams,
ArrayList<SetWidgetsParams> visibilityWidgetsParams,
ArrayList<SetWidgetsParams> availabilityWidgetsParams,
ArrayList<PluginParams> pluginsParams,
List<String> featuresEnabledIds,
List<String> featuresDisabledIds,
List<String> featuresEnabledPatterns,
List<String> featuresDisabledPatterns) {
this.settingsParams = settingsParams;
this.navDrawerHeaderParams = navDrawerHeaderParams;
this.navDrawerFooterParams = navDrawerFooterParams;
this.navDrawerItemsParams = navDrawerItemsParams;
if (visibilityWidgetsParams != null) {
this.visibilityWidgetsParams.addAll(visibilityWidgetsParams);
}
if (availabilityWidgetsParams != null) {
this.availabilityWidgetsParams.addAll(availabilityWidgetsParams);
}
if (pluginsParams != null) {
this.pluginsParams.addAll(pluginsParams);
}
if (featuresEnabledIds != null) {
this.featuresEnabledIds.addAll(featuresEnabledIds);
}
if (featuresDisabledIds != null) {
this.featuresDisabledIds.addAll(featuresDisabledIds);
}
if (featuresEnabledPatterns != null) {
this.featuresEnabledPatterns.addAll(featuresEnabledPatterns);
}
if (featuresDisabledPatterns != null) {
this.featuresDisabledPatterns.addAll(featuresDisabledPatterns);
}
}
public CustomizationInfoParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<CustomizationInfoParams> CREATOR = new Creator<CustomizationInfoParams>() {
@Override
public CustomizationInfoParams createFromParcel(Parcel in) {
return new CustomizationInfoParams(in);
}
@Override
public CustomizationInfoParams[] newArray(int size) {
return new CustomizationInfoParams[size];
}
};
public OsmandSettingsParams getSettingsParams() {
return settingsParams;
}
public NavDrawerHeaderParams getNavDrawerHeaderParams() {
return navDrawerHeaderParams;
}
public NavDrawerFooterParams getNavDrawerFooterParams() {
return navDrawerFooterParams;
}
public SetNavDrawerItemsParams getNavDrawerItemsParams() {
return navDrawerItemsParams;
}
public ArrayList<SetWidgetsParams> getVisibilityWidgetsParams() {
return visibilityWidgetsParams;
}
public ArrayList<SetWidgetsParams> getAvailabilityWidgetsParams() {
return availabilityWidgetsParams;
}
public ArrayList<PluginParams> getPluginsParams() {
return pluginsParams;
}
public List<String> getFeaturesEnabledIds() {
return featuresEnabledIds;
}
public List<String> getFeaturesDisabledIds() {
return featuresDisabledIds;
}
public List<String> getFeaturesEnabledPatterns() {
return featuresEnabledPatterns;
}
public List<String> getFeaturesDisabledPatterns() {
return featuresDisabledPatterns;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(settingsParams, flags);
out.writeParcelable(navDrawerHeaderParams, flags);
out.writeParcelable(navDrawerFooterParams, flags);
out.writeParcelable(navDrawerItemsParams, flags);
out.writeTypedList(visibilityWidgetsParams);
out.writeTypedList(availabilityWidgetsParams);
out.writeTypedList(pluginsParams);
out.writeStringList(featuresEnabledIds);
out.writeStringList(featuresDisabledIds);
out.writeStringList(featuresEnabledPatterns);
out.writeStringList(featuresDisabledPatterns);
}
@SuppressLint("ParcelClassLoader")
private void readFromParcel(Parcel in) {
settingsParams = in.readParcelable(OsmandSettingsParams.class.getClassLoader());
navDrawerHeaderParams = in.readParcelable(NavDrawerHeaderParams.class.getClassLoader());
navDrawerFooterParams = in.readParcelable(NavDrawerFooterParams.class.getClassLoader());
navDrawerItemsParams = in.readParcelable(SetNavDrawerItemsParams.class.getClassLoader());
in.readTypedList(visibilityWidgetsParams, SetWidgetsParams.CREATOR);
in.readTypedList(availabilityWidgetsParams, SetWidgetsParams.CREATOR);
in.readTypedList(pluginsParams, PluginParams.CREATOR);
in.readStringList(featuresEnabledIds);
in.readStringList(featuresDisabledIds);
in.readStringList(featuresEnabledPatterns);
in.readStringList(featuresDisabledPatterns);
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.customization;
parcelable OsmandSettingsInfoParams;

View file

@ -0,0 +1,50 @@
package net.osmand.aidl.customization;
import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
public class OsmandSettingsInfoParams implements Parcelable {
private String sharedPreferencesName;
public OsmandSettingsInfoParams(@NonNull String sharedPreferencesName) {
this.sharedPreferencesName = sharedPreferencesName;
}
public OsmandSettingsInfoParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<OsmandSettingsInfoParams> CREATOR = new Creator<OsmandSettingsInfoParams>() {
@Override
public OsmandSettingsInfoParams createFromParcel(Parcel in) {
return new OsmandSettingsInfoParams(in);
}
@Override
public OsmandSettingsInfoParams[] newArray(int size) {
return new OsmandSettingsInfoParams[size];
}
};
public String getSharedPreferencesName() {
return sharedPreferencesName;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeString(sharedPreferencesName);
}
@SuppressLint("ParcelClassLoader")
private void readFromParcel(Parcel in) {
sharedPreferencesName = in.readString();
}
@Override
public int describeContents() {
return 0;
}
}

Some files were not shown because too many files have changed in this diff Show more