mirror of
https://gitlab.com/neothefox/LayTray
synced 2026-03-23 21:54:54 +03:00
Code cleanup and consistency
This commit is contained in:
parent
7de80ab3ec
commit
9f6332f9b4
@ -3,10 +3,12 @@ package space.neothefox.laytray;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
public class AboutActivity extends Activity {
|
public class AboutActivity extends Activity
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_about);
|
setContentView(R.layout.activity_about);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,19 +16,22 @@ import android.view.ViewGroup;
|
|||||||
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||||
* to be used with AppCompat.
|
* to be used with AppCompat.
|
||||||
*/
|
*/
|
||||||
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
public abstract class AppCompatPreferenceActivity extends PreferenceActivity
|
||||||
|
{
|
||||||
|
|
||||||
private AppCompatDelegate mDelegate;
|
private AppCompatDelegate mDelegate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
getDelegate().installViewFactory();
|
getDelegate().installViewFactory();
|
||||||
getDelegate().onCreate(savedInstanceState);
|
getDelegate().onCreate(savedInstanceState);
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
protected void onPostCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
getDelegate().onPostCreate(savedInstanceState);
|
getDelegate().onPostCreate(savedInstanceState);
|
||||||
}
|
}
|
||||||
@ -37,17 +40,20 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||||||
return getDelegate().getSupportActionBar();
|
return getDelegate().getSupportActionBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
public void setSupportActionBar(@Nullable Toolbar toolbar)
|
||||||
|
{
|
||||||
getDelegate().setSupportActionBar(toolbar);
|
getDelegate().setSupportActionBar(toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MenuInflater getMenuInflater() {
|
public MenuInflater getMenuInflater()
|
||||||
|
{
|
||||||
return getDelegate().getMenuInflater();
|
return getDelegate().getMenuInflater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(@LayoutRes int layoutResID) {
|
public void setContentView(@LayoutRes int layoutResID)
|
||||||
|
{
|
||||||
getDelegate().setContentView(layoutResID);
|
getDelegate().setContentView(layoutResID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,51 +63,61 @@ public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
public void setContentView(View view, ViewGroup.LayoutParams params)
|
||||||
|
{
|
||||||
getDelegate().setContentView(view, params);
|
getDelegate().setContentView(view, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
public void addContentView(View view, ViewGroup.LayoutParams params)
|
||||||
|
{
|
||||||
getDelegate().addContentView(view, params);
|
getDelegate().addContentView(view, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostResume() {
|
protected void onPostResume()
|
||||||
|
{
|
||||||
super.onPostResume();
|
super.onPostResume();
|
||||||
getDelegate().onPostResume();
|
getDelegate().onPostResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onTitleChanged(CharSequence title, int color) {
|
protected void onTitleChanged(CharSequence title, int color)
|
||||||
|
{
|
||||||
super.onTitleChanged(title, color);
|
super.onTitleChanged(title, color);
|
||||||
getDelegate().setTitle(title);
|
getDelegate().setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newConfig) {
|
public void onConfigurationChanged(Configuration newConfig)
|
||||||
|
{
|
||||||
super.onConfigurationChanged(newConfig);
|
super.onConfigurationChanged(newConfig);
|
||||||
getDelegate().onConfigurationChanged(newConfig);
|
getDelegate().onConfigurationChanged(newConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop()
|
||||||
|
{
|
||||||
super.onStop();
|
super.onStop();
|
||||||
getDelegate().onStop();
|
getDelegate().onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy()
|
||||||
|
{
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
getDelegate().onDestroy();
|
getDelegate().onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void invalidateOptionsMenu() {
|
public void invalidateOptionsMenu()
|
||||||
|
{
|
||||||
getDelegate().invalidateOptionsMenu();
|
getDelegate().invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
private AppCompatDelegate getDelegate() {
|
private AppCompatDelegate getDelegate()
|
||||||
if (mDelegate == null) {
|
{
|
||||||
|
if (mDelegate == null)
|
||||||
|
{
|
||||||
mDelegate = AppCompatDelegate.create(this, null);
|
mDelegate = AppCompatDelegate.create(this, null);
|
||||||
}
|
}
|
||||||
return mDelegate;
|
return mDelegate;
|
||||||
|
|||||||
@ -15,29 +15,34 @@ import android.widget.LinearLayout;
|
|||||||
|
|
||||||
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
|
import static android.graphics.Paint.ANTI_ALIAS_FLAG;
|
||||||
|
|
||||||
public class IconBuilderPreview extends View {
|
public class IconBuilderPreview extends View
|
||||||
|
{
|
||||||
|
|
||||||
int mode;
|
int mode;
|
||||||
int textSize;
|
int textSize;
|
||||||
boolean fakeBold;
|
boolean fakeBold;
|
||||||
int textColor;
|
int textColor;
|
||||||
|
|
||||||
public IconBuilderPreview(Context context) {
|
public IconBuilderPreview(Context context)
|
||||||
|
{
|
||||||
super(context);
|
super(context);
|
||||||
initValues();
|
initValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs) {
|
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs)
|
||||||
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
initValues();
|
initValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs, int defStyleAttr)
|
||||||
|
{
|
||||||
super(context, attrs, defStyleAttr);
|
super(context, attrs, defStyleAttr);
|
||||||
initValues();
|
initValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
public IconBuilderPreview(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
||||||
|
{
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
initValues();
|
initValues();
|
||||||
}
|
}
|
||||||
@ -50,7 +55,8 @@ public class IconBuilderPreview extends View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas)
|
||||||
|
{
|
||||||
super.onDraw(canvas);
|
super.onDraw(canvas);
|
||||||
mode = 2;
|
mode = 2;
|
||||||
fakeBold = true;
|
fakeBold = true;
|
||||||
@ -102,35 +108,43 @@ public class IconBuilderPreview extends View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMode() {
|
public int getMode()
|
||||||
|
{
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTextSize() {
|
public int getTextSize()
|
||||||
|
{
|
||||||
return textSize;
|
return textSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFakeBold() {
|
public boolean isFakeBold()
|
||||||
|
{
|
||||||
return fakeBold;
|
return fakeBold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTextColor() {
|
public int getTextColor()
|
||||||
|
{
|
||||||
return textColor;
|
return textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMode(int mode) {
|
public void setMode(int mode)
|
||||||
|
{
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextSize(int textSize) {
|
public void setTextSize(int textSize)
|
||||||
|
{
|
||||||
this.textSize = textSize * 10;
|
this.textSize = textSize * 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFakeBold(boolean fakeBold) {
|
public void setFakeBold(boolean fakeBold)
|
||||||
|
{
|
||||||
this.fakeBold = fakeBold;
|
this.fakeBold = fakeBold;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(int textColor) {
|
public void setTextColor(int textColor)
|
||||||
|
{
|
||||||
this.textColor = textColor;
|
this.textColor = textColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,8 @@ import static android.graphics.Paint.ANTI_ALIAS_FLAG;
|
|||||||
|
|
||||||
|
|
||||||
public class IconService extends AccessibilityService
|
public class IconService extends AccessibilityService
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener{
|
implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
|
{
|
||||||
|
|
||||||
public static String TAG = "layicon";
|
public static String TAG = "layicon";
|
||||||
public static String channelId = "space.neothefox.laytray.IC";
|
public static String channelId = "space.neothefox.laytray.IC";
|
||||||
@ -38,7 +39,8 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
NotificationChannel iconChannel;
|
NotificationChannel iconChannel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onServiceConnected() {
|
protected void onServiceConnected()
|
||||||
|
{
|
||||||
super.onServiceConnected();
|
super.onServiceConnected();
|
||||||
Log.d(TAG, "Icon service started");
|
Log.d(TAG, "Icon service started");
|
||||||
serviceInfo.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
|
serviceInfo.eventTypes = AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED;
|
||||||
@ -52,7 +54,8 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
options.registerOnSharedPreferenceChangeListener(this);
|
options.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
iconManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
iconManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||||
|
{
|
||||||
|
|
||||||
iconChannel = iconManager.getNotificationChannel(channelId);
|
iconChannel = iconManager.getNotificationChannel(channelId);
|
||||||
if(iconChannel == null) {
|
if(iconChannel == null) {
|
||||||
@ -95,7 +98,8 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
.setVisibility(Notification.VISIBILITY_SECRET)
|
.setVisibility(Notification.VISIBILITY_SECRET)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
indicator = new Notification.Builder(this)
|
indicator = new Notification.Builder(this)
|
||||||
.setSmallIcon(smallIcon)
|
.setSmallIcon(smallIcon)
|
||||||
.setContentTitle(toast)
|
.setContentTitle(toast)
|
||||||
@ -109,7 +113,8 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Borrowed from Ted Hopp from StackOverflow
|
//Borrowed from Ted Hopp from StackOverflow
|
||||||
public static Bitmap textAsBitmap(String text, float textSize, boolean fakeBold, int mode, int textColor) {
|
public static Bitmap textAsBitmap(String text, float textSize, boolean fakeBold, int mode, int textColor)
|
||||||
|
{
|
||||||
Paint paint = new Paint(ANTI_ALIAS_FLAG);
|
Paint paint = new Paint(ANTI_ALIAS_FLAG);
|
||||||
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
|
||||||
paint.setTextSize(textSize);
|
paint.setTextSize(textSize);
|
||||||
@ -175,7 +180,8 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccessibilityEvent(AccessibilityEvent event) {
|
public void onAccessibilityEvent(AccessibilityEvent event)
|
||||||
|
{
|
||||||
|
|
||||||
Log.d(TAG, event.toString());
|
Log.d(TAG, event.toString());
|
||||||
if(event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
|
if(event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED)
|
||||||
@ -188,19 +194,18 @@ implements SharedPreferences.OnSharedPreferenceChangeListener{
|
|||||||
updateNotification(lastToast);
|
updateNotification(lastToast);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
Log.d(TAG, "Caution! This service had been tampered with!");
|
Log.d(TAG, "Caution! This service had been tampered with!");
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInterrupt() {
|
public void onInterrupt()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
|
||||||
|
{
|
||||||
options = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
options = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
updateNotification(lastToast);
|
updateNotification(lastToast);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,8 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
public String TAG = "layiconActivity";
|
public String TAG = "layiconActivity";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
layoutLister = findViewById(R.id.scrollLinearLayout);
|
layoutLister = findViewById(R.id.scrollLinearLayout);
|
||||||
@ -47,7 +48,8 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
addButton.setOnClickListener(this);
|
addButton.setOnClickListener(this);
|
||||||
layouts.registerOnSharedPreferenceChangeListener(this);
|
layouts.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
if (!isAccessibilitySettingsOn(getApplicationContext())) {
|
if (!isAccessibilitySettingsOn(getApplicationContext()))
|
||||||
|
{
|
||||||
Toast.makeText(this, R.string.toast_enableme,
|
Toast.makeText(this, R.string.toast_enableme,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
|
||||||
@ -73,7 +75,8 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
{
|
{
|
||||||
Log.d(TAG, "listing map:");
|
Log.d(TAG, "listing map:");
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Map.Entry<String,?> entry : keys.entrySet()){
|
for(Map.Entry<String,?> entry : keys.entrySet())
|
||||||
|
{
|
||||||
Log.d("map values",entry.getKey() + ": " +
|
Log.d("map values",entry.getKey() + ": " +
|
||||||
entry.getValue().toString());
|
entry.getValue().toString());
|
||||||
i++;
|
i++;
|
||||||
@ -128,9 +131,11 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
removeButton.setText("➖");
|
removeButton.setText("➖");
|
||||||
removeButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
removeButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
removeButton.setOnClickListener(new View.OnClickListener() {
|
removeButton.setOnClickListener(new View.OnClickListener()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v)
|
||||||
|
{
|
||||||
LinearLayout daddy = (LinearLayout)removeButton.getParent();
|
LinearLayout daddy = (LinearLayout)removeButton.getParent();
|
||||||
LinearLayout grandpa = (LinearLayout)daddy.getParent();
|
LinearLayout grandpa = (LinearLayout)daddy.getParent();
|
||||||
daddy.removeAllViewsInLayout();
|
daddy.removeAllViewsInLayout();
|
||||||
@ -171,46 +176,55 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
|
|
||||||
|
|
||||||
//Accessibility check by Antoine Bolvy
|
//Accessibility check by Antoine Bolvy
|
||||||
private boolean isAccessibilitySettingsOn(Context mContext) {
|
private boolean isAccessibilitySettingsOn(Context mContext)
|
||||||
|
{
|
||||||
int accessibilityEnabled = 0;
|
int accessibilityEnabled = 0;
|
||||||
final String service = getPackageName() + "/" + IconService.class.getCanonicalName();
|
final String service = getPackageName() + "/" + IconService.class.getCanonicalName();
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
accessibilityEnabled = Settings.Secure.getInt(
|
accessibilityEnabled = Settings.Secure.getInt(
|
||||||
mContext.getApplicationContext().getContentResolver(),
|
mContext.getApplicationContext().getContentResolver(),
|
||||||
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
|
android.provider.Settings.Secure.ACCESSIBILITY_ENABLED);
|
||||||
Log.v(TAG, "accessibilityEnabled = " + accessibilityEnabled);
|
Log.v(TAG, "accessibilityEnabled = " + accessibilityEnabled);
|
||||||
} catch (Settings.SettingNotFoundException e) {
|
}
|
||||||
|
catch (Settings.SettingNotFoundException e)
|
||||||
|
{
|
||||||
Log.e(TAG, "Error finding setting, default accessibility to not found: "
|
Log.e(TAG, "Error finding setting, default accessibility to not found: "
|
||||||
+ e.getMessage());
|
+ e.getMessage());
|
||||||
}
|
}
|
||||||
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
|
TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':');
|
||||||
|
|
||||||
if (accessibilityEnabled == 1) {
|
if (accessibilityEnabled == 1)
|
||||||
|
{
|
||||||
Log.v(TAG, "Accessibility service enabled");
|
Log.v(TAG, "Accessibility service enabled");
|
||||||
String settingValue = Settings.Secure.getString(
|
String settingValue = Settings.Secure.getString(
|
||||||
mContext.getApplicationContext().getContentResolver(),
|
mContext.getApplicationContext().getContentResolver(),
|
||||||
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
|
Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);
|
||||||
if (settingValue != null) {
|
if (settingValue != null)
|
||||||
|
{
|
||||||
mStringColonSplitter.setString(settingValue);
|
mStringColonSplitter.setString(settingValue);
|
||||||
while (mStringColonSplitter.hasNext()) {
|
while (mStringColonSplitter.hasNext())
|
||||||
|
{
|
||||||
String accessibilityService = mStringColonSplitter.next();
|
String accessibilityService = mStringColonSplitter.next();
|
||||||
|
|
||||||
Log.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service);
|
Log.v(TAG, "-------------- > accessibilityService :: " + accessibilityService + " " + service);
|
||||||
if (accessibilityService.equalsIgnoreCase(service)) {
|
if (accessibilityService.equalsIgnoreCase(service))
|
||||||
|
{
|
||||||
Log.v(TAG, "We've found the correct setting - accessibility is switched on!");
|
Log.v(TAG, "We've found the correct setting - accessibility is switched on!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Log.v(TAG, "Accessibility is disabled");
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Log.v(TAG, "Accessibility is disabled");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v)
|
||||||
|
{
|
||||||
switch(v.getId())
|
switch(v.getId())
|
||||||
{
|
{
|
||||||
case R.id.floatingActionButton:
|
case R.id.floatingActionButton:
|
||||||
@ -221,14 +235,16 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu)
|
||||||
|
{
|
||||||
MenuInflater inflater = getMenuInflater();
|
MenuInflater inflater = getMenuInflater();
|
||||||
inflater.inflate(R.menu.menu, menu);
|
inflater.inflate(R.menu.menu, menu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
public boolean onOptionsItemSelected(MenuItem item)
|
||||||
|
{
|
||||||
switch(item.getItemId())
|
switch(item.getItemId())
|
||||||
{
|
{
|
||||||
case R.id.settings:
|
case R.id.settings:
|
||||||
@ -243,22 +259,28 @@ implements View.OnClickListener, DialogInterface.OnClickListener, SharedPreferen
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
|
||||||
|
{
|
||||||
layouts = getSharedPreferences("layouts", 0);
|
layouts = getSharedPreferences("layouts", 0);
|
||||||
updateLayouts();
|
updateLayouts();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPackageInstalled(String packageName, PackageManager packageManager) {
|
private boolean isPackageInstalled(String packageName, PackageManager packageManager)
|
||||||
try {
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
packageManager.getPackageInfo(packageName, 0);
|
packageManager.getPackageInfo(packageName, 0);
|
||||||
return true;
|
return true;
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
}
|
||||||
|
catch (PackageManager.NameNotFoundException e)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i)
|
||||||
|
{
|
||||||
//There is only one potential dialog
|
//There is only one potential dialog
|
||||||
this.finish();
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,12 @@ package space.neothefox.laytray;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
|
import android.support.v7.widget.AppCompatSeekBar;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.widget.SeekBar;
|
|
||||||
|
|
||||||
public class VerticalSeekBar extends SeekBar {
|
public class VerticalSeekBar extends AppCompatSeekBar
|
||||||
|
{
|
||||||
|
|
||||||
public VerticalSeekBar(Context context) {
|
public VerticalSeekBar(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user