mirror of
https://github.com/fankes/termux-app.git
synced 2025-09-07 03:05:18 +08:00
Added: Add SharedPrefernces controllers for all current published termux plugin app
Also added log level setting in Termux Settings for Termux:API. Others can be added when logging is implemented in the plugin apps via `Logger` class provided by `termux-shared`.
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.packages.PackageUtils;
|
||||
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_API_APP;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TermuxAPIAppSharedPreferences {
|
||||
|
||||
private final Context mContext;
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
|
||||
private static final String LOG_TAG = "TermuxAPIAppSharedPreferences";
|
||||
|
||||
private TermuxAPIAppSharedPreferences(@Nonnull Context context) {
|
||||
mContext = context;
|
||||
mSharedPreferences = getPrivateSharedPreferences(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Context} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_API_PACKAGE_NAME}.
|
||||
* @return Returns the {@link TermuxAPIAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
@Nullable
|
||||
public static TermuxAPIAppSharedPreferences build(@NonNull final Context context) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackage(context, TermuxConstants.TERMUX_API_PACKAGE_NAME);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxAPIAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Activity} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_API_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxAPIAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxAPIAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_API_PACKAGE_NAME, exitAppOnError);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxAPIAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
private static SharedPreferences getPrivateSharedPreferences(Context context) {
|
||||
if (context == null) return null;
|
||||
return SharedPreferenceUtils.getPrivateSharedPreferences(context, TermuxConstants.TERMUX_API_DEFAULT_PREFERENCES_FILE_BASENAME_WITHOUT_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getLogLevel() {
|
||||
return SharedPreferenceUtils.getInt(mSharedPreferences, TERMUX_API_APP.KEY_LOG_LEVEL, Logger.DEFAULT_LOG_LEVEL);
|
||||
}
|
||||
|
||||
public void setLogLevel(Context context, int logLevel) {
|
||||
logLevel = Logger.setLogLevel(context, logLevel);
|
||||
SharedPreferenceUtils.setInt(mSharedPreferences, TERMUX_API_APP.KEY_LOG_LEVEL, logLevel, false);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.packages.PackageUtils;
|
||||
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_BOOT_APP;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TermuxBootAppSharedPreferences {
|
||||
|
||||
private final Context mContext;
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
|
||||
private static final String LOG_TAG = "TermuxBootAppSharedPreferences";
|
||||
|
||||
private TermuxBootAppSharedPreferences(@Nonnull Context context) {
|
||||
mContext = context;
|
||||
mSharedPreferences = getPrivateSharedPreferences(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Context} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_BOOT_PACKAGE_NAME}.
|
||||
* @return Returns the {@link TermuxBootAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
@Nullable
|
||||
public static TermuxBootAppSharedPreferences build(@NonNull final Context context) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackage(context, TermuxConstants.TERMUX_BOOT_PACKAGE_NAME);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxBootAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Activity} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_BOOT_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxBootAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxBootAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_BOOT_PACKAGE_NAME, exitAppOnError);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxBootAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
private static SharedPreferences getPrivateSharedPreferences(Context context) {
|
||||
if (context == null) return null;
|
||||
return SharedPreferenceUtils.getPrivateSharedPreferences(context, TermuxConstants.TERMUX_BOOT_DEFAULT_PREFERENCES_FILE_BASENAME_WITHOUT_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getLogLevel() {
|
||||
return SharedPreferenceUtils.getInt(mSharedPreferences, TERMUX_BOOT_APP.KEY_LOG_LEVEL, Logger.DEFAULT_LOG_LEVEL);
|
||||
}
|
||||
|
||||
public void setLogLevel(Context context, int logLevel) {
|
||||
logLevel = Logger.setLogLevel(context, logLevel);
|
||||
SharedPreferenceUtils.setInt(mSharedPreferences, TERMUX_BOOT_APP.KEY_LOG_LEVEL, logLevel, false);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.packages.PackageUtils;
|
||||
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_FLOAT_APP;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TermuxFloatAppSharedPreferences {
|
||||
|
||||
private final Context mContext;
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
|
||||
private static final String LOG_TAG = "TermuxFloatAppSharedPreferences";
|
||||
|
||||
private TermuxFloatAppSharedPreferences(@Nonnull Context context) {
|
||||
mContext = context;
|
||||
mSharedPreferences = getPrivateSharedPreferences(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Context} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_FLOAT_PACKAGE_NAME}.
|
||||
* @return Returns the {@link TermuxFloatAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
@Nullable
|
||||
public static TermuxFloatAppSharedPreferences build(@NonNull final Context context) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackage(context, TermuxConstants.TERMUX_FLOAT_PACKAGE_NAME);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxFloatAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Activity} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_FLOAT_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxFloatAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxFloatAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_FLOAT_PACKAGE_NAME, exitAppOnError);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxFloatAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
private static SharedPreferences getPrivateSharedPreferences(Context context) {
|
||||
if (context == null) return null;
|
||||
return SharedPreferenceUtils.getPrivateSharedPreferences(context, TermuxConstants.TERMUX_FLOAT_DEFAULT_PREFERENCES_FILE_BASENAME_WITHOUT_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getLogLevel() {
|
||||
return SharedPreferenceUtils.getInt(mSharedPreferences, TERMUX_FLOAT_APP.KEY_LOG_LEVEL, Logger.DEFAULT_LOG_LEVEL);
|
||||
}
|
||||
|
||||
public void setLogLevel(Context context, int logLevel) {
|
||||
logLevel = Logger.setLogLevel(context, logLevel);
|
||||
SharedPreferenceUtils.setInt(mSharedPreferences, TERMUX_FLOAT_APP.KEY_LOG_LEVEL, logLevel, false);
|
||||
}
|
||||
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
/*
|
||||
* Version: v0.11.0
|
||||
* Version: v0.12.0
|
||||
*
|
||||
* Changelog
|
||||
*
|
||||
@@ -48,6 +48,11 @@ package com.termux.shared.settings.preferences;
|
||||
* - 0.11.0 (2021-07-08)
|
||||
* - Added following to `TERMUX_APP`:
|
||||
* `KEY_DISABLE_TERMINAL_MARGIN_ADJUSTMENT`.
|
||||
*
|
||||
* - 0.12.0 (2021-08-27)
|
||||
* - Added `TERMUX_API_APP.KEY_LOG_LEVEL`, `TERMUX_BOOT_APP.KEY_LOG_LEVEL`,
|
||||
* `TERMUX_FLOAT_APP.KEY_LOG_LEVEL`, `TERMUX_STYLING_APP.KEY_LOG_LEVEL`,
|
||||
* `TERMUX_Widget_APP.KEY_LOG_LEVEL`.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -115,7 +120,7 @@ public final class TermuxPreferenceConstants {
|
||||
|
||||
|
||||
/**
|
||||
* Defines the key for current termux log level.
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
@@ -147,13 +152,85 @@ public final class TermuxPreferenceConstants {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux API app constants.
|
||||
*/
|
||||
public static final class TERMUX_API_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux Boot app constants.
|
||||
*/
|
||||
public static final class TERMUX_BOOT_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux Float app constants.
|
||||
*/
|
||||
public static final class TERMUX_FLOAT_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux Styling app constants.
|
||||
*/
|
||||
public static final class TERMUX_STYLING_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux Tasker app constants.
|
||||
*/
|
||||
public static final class TERMUX_TASKER_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current termux log level.
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Termux Widget app constants.
|
||||
*/
|
||||
public static final class TERMUX_WIDGET_APP {
|
||||
|
||||
/**
|
||||
* Defines the key for current log level.
|
||||
*/
|
||||
public static final String KEY_LOG_LEVEL = "log_level";
|
||||
|
||||
|
@@ -0,0 +1,79 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.packages.PackageUtils;
|
||||
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_STYLING_APP;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TermuxStylingAppSharedPreferences {
|
||||
|
||||
private final Context mContext;
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
|
||||
private static final String LOG_TAG = "TermuxStylingAppSharedPreferences";
|
||||
|
||||
private TermuxStylingAppSharedPreferences(@Nonnull Context context) {
|
||||
mContext = context;
|
||||
mSharedPreferences = getPrivateSharedPreferences(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Context} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_STYLING_PACKAGE_NAME}.
|
||||
* @return Returns the {@link TermuxStylingAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
@Nullable
|
||||
public static TermuxStylingAppSharedPreferences build(@NonNull final Context context) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackage(context, TermuxConstants.TERMUX_STYLING_PACKAGE_NAME);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxStylingAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Activity} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_STYLING_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxStylingAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxStylingAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_STYLING_PACKAGE_NAME, exitAppOnError);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxStylingAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
private static SharedPreferences getPrivateSharedPreferences(Context context) {
|
||||
if (context == null) return null;
|
||||
return SharedPreferenceUtils.getPrivateSharedPreferences(context, TermuxConstants.TERMUX_STYLING_DEFAULT_PREFERENCES_FILE_BASENAME_WITHOUT_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getLogLevel() {
|
||||
return SharedPreferenceUtils.getInt(mSharedPreferences, TERMUX_STYLING_APP.KEY_LOG_LEVEL, Logger.DEFAULT_LOG_LEVEL);
|
||||
}
|
||||
|
||||
public void setLogLevel(Context context, int logLevel) {
|
||||
logLevel = Logger.setLogLevel(context, logLevel);
|
||||
SharedPreferenceUtils.setInt(mSharedPreferences, TERMUX_STYLING_APP.KEY_LOG_LEVEL, logLevel, false);
|
||||
}
|
||||
|
||||
}
|
@@ -52,7 +52,7 @@ public class TermuxTaskerAppSharedPreferences {
|
||||
* {@link TermuxConstants#TERMUX_TASKER_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
* @return Returns the {@link TermuxTaskerAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxTaskerAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_TASKER_PACKAGE_NAME, exitAppOnError);
|
||||
|
@@ -0,0 +1,79 @@
|
||||
package com.termux.shared.settings.preferences;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.termux.shared.logger.Logger;
|
||||
import com.termux.shared.packages.PackageUtils;
|
||||
import com.termux.shared.settings.preferences.TermuxPreferenceConstants.TERMUX_WIDGET_APP;
|
||||
import com.termux.shared.termux.TermuxConstants;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TermuxWidgetAppSharedPreferences {
|
||||
|
||||
private final Context mContext;
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
|
||||
|
||||
private static final String LOG_TAG = "TermuxWidgetAppSharedPreferences";
|
||||
|
||||
private TermuxWidgetAppSharedPreferences(@Nonnull Context context) {
|
||||
mContext = context;
|
||||
mSharedPreferences = getPrivateSharedPreferences(mContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Context} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_WIDGET_PACKAGE_NAME}.
|
||||
* @return Returns the {@link TermuxWidgetAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
@Nullable
|
||||
public static TermuxWidgetAppSharedPreferences build(@NonNull final Context context) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackage(context, TermuxConstants.TERMUX_WIDGET_PACKAGE_NAME);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxWidgetAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the {@link Context} for a package name.
|
||||
*
|
||||
* @param context The {@link Activity} to use to get the {@link Context} of the
|
||||
* {@link TermuxConstants#TERMUX_WIDGET_PACKAGE_NAME}.
|
||||
* @param exitAppOnError If {@code true} and failed to get package context, then a dialog will
|
||||
* be shown which when dismissed will exit the app.
|
||||
* @return Returns the {@link TermuxWidgetAppSharedPreferences}. This will {@code null} if an exception is raised.
|
||||
*/
|
||||
public static TermuxWidgetAppSharedPreferences build(@NonNull final Context context, final boolean exitAppOnError) {
|
||||
Context termuxTaskerPackageContext = PackageUtils.getContextForPackageOrExitApp(context, TermuxConstants.TERMUX_WIDGET_PACKAGE_NAME, exitAppOnError);
|
||||
if (termuxTaskerPackageContext == null)
|
||||
return null;
|
||||
else
|
||||
return new TermuxWidgetAppSharedPreferences(termuxTaskerPackageContext);
|
||||
}
|
||||
|
||||
private static SharedPreferences getPrivateSharedPreferences(Context context) {
|
||||
if (context == null) return null;
|
||||
return SharedPreferenceUtils.getPrivateSharedPreferences(context, TermuxConstants.TERMUX_WIDGET_DEFAULT_PREFERENCES_FILE_BASENAME_WITHOUT_EXTENSION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int getLogLevel() {
|
||||
return SharedPreferenceUtils.getInt(mSharedPreferences, TERMUX_WIDGET_APP.KEY_LOG_LEVEL, Logger.DEFAULT_LOG_LEVEL);
|
||||
}
|
||||
|
||||
public void setLogLevel(Context context, int logLevel) {
|
||||
logLevel = Logger.setLogLevel(context, logLevel);
|
||||
SharedPreferenceUtils.setInt(mSharedPreferences, TERMUX_WIDGET_APP.KEY_LOG_LEVEL, logLevel, false);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user