Skip to content

Commit

Permalink
cleanup code
Browse files Browse the repository at this point in the history
Signed-off-by: Saul Henriquez <[email protected]>
  • Loading branch information
saulhdev committed Sep 29, 2020
1 parent fd9f5fa commit 5806038
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Omega/src/com/saggitt/omega/OmegaPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import kotlin.collections.HashSet
import kotlin.reflect.KProperty

class OmegaPreferences(val context: Context) : SharedPreferences.OnSharedPreferenceChangeListener {
val mContext = context;
val mContext = context

val doNothing = { }
val restart = { restart() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class LauncherGesturePreference(context: Context, attrs: AttributeSet?) : Recycl
field = value
notifyChanged()
}
var defaultValue = BlankGestureHandler::class.java.name!!
var defaultValue = BlankGestureHandler::class.java.name
lateinit var onSelectHandler: (GestureHandler) -> Unit
private val mContext = context;
private val mContext = context
private val blankGestureHandler = BlankGestureHandler(mContext, null)
private val handler get() = GestureController.createGestureHandler(mContext, value.toString(), blankGestureHandler)

Expand Down
2 changes: 1 addition & 1 deletion Omega/src/com/saggitt/omega/groups/FlowerpotTabs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class FlowerpotTabs(manager: AppGroupsManager) : DrawerTabs(manager, AppGroupsMa
}

private fun updateSummary(view: View) {
view.findViewById<TextView>(R.id.current_category).setText(displayName)
view.findViewById<TextView>(R.id.current_category).text = displayName
}

override fun clone(): AppGroups.Group.Customization<String, String> {
Expand Down
8 changes: 4 additions & 4 deletions Omega/src/com/saggitt/omega/iconpack/IconMask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class IconMask {
val canvas = Canvas(bitmap)

// Draw the app icon
var bb = baseIcon.toBitmap()!!
var bb = baseIcon.toBitmap()
if (!bb.isMutable) bb = bb.copy(bb.config, true)
matrix.setScale((size * scale) / bb.width, (size * scale) / bb.height)
matrix.postTranslate((size / 2) * (1 - scale), (size / 2) * (1 - scale))
Expand All @@ -67,7 +67,7 @@ class IconMask {

// Mask the app icon
if (iconMask != null && iconMask.drawableId != 0) {
iconMask.drawable.toBitmap()?.let {
iconMask.drawable.toBitmap().let {
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OUT)
matrix.setScale(size.toFloat() / it.width, size.toFloat() / it.height)
canvas.drawBitmap(it, matrix, paint)
Expand All @@ -82,7 +82,7 @@ class IconMask {
if (Utilities.ATLEAST_OREO && drawable is AdaptiveIconCompat) {
adaptiveBackground = drawable.background
} else {
drawable.toBitmap()!!.let {
drawable.toBitmap().let {
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.DST_OVER)
matrix.setScale(size.toFloat() / it.width, size.toFloat() / it.height)
canvas.drawBitmap(it, matrix, paint)
Expand All @@ -94,7 +94,7 @@ class IconMask {

// Draw iconUpon
if (iconUpon != null && iconUpon.drawableId != 0) {
iconUpon.drawable.toBitmap()!!.let {
iconUpon.drawable.toBitmap().let {
matrix.setScale(size.toFloat() / it.width, size.toFloat() / it.height)
canvas.drawBitmap(it, matrix, paint)
matrix.reset()
Expand Down
2 changes: 1 addition & 1 deletion Omega/src/com/saggitt/omega/iconpack/IconPackList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class IconPackList(private val context: Context, private val manager: IconPackMa
}

override val displayIcon by lazy {
context.packageManager.getApplicationIcon(applicationInfo)!!
context.packageManager.getApplicationIcon(applicationInfo)
}

override val displayName by lazy {
Expand Down
1 change: 0 additions & 1 deletion Omega/src/com/saggitt/omega/icons/IconShapeOverride.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public static String getAppliedValue(Context context) {
if (!TextUtils.isEmpty(devValue)) {
// Migrate to general preferences to back up shape overrides
getPrefs(context).edit().putString(KEY_PREFERENCE, devValue).apply();
;
getDevicePrefs(context).edit().remove(KEY_PREFERENCE).apply();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ class MultiSelectTabPreference(context: Context, attrs: AttributeSet?) : Recycle
private val selections = mutableMapOf<DrawerTabs.CustomTab, Boolean>()
private val tabs = context.omegaPrefs.drawerTabs.getGroups().mapNotNull { it as? DrawerTabs.CustomTab }
var edited = false
private set(value) {
field = value
}
private set

override fun onBindRecyclerView(recyclerView: RecyclerView) {
recyclerView.adapter = Adapter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class SelectSearchProviderFragment : PreferenceDialogFragmentCompat() {
}

inner class Holder(itemView: View) : RecyclerView.ViewHolder(itemView), View.OnClickListener {
val providerIcon = itemView.findViewById<ImageView>(R.id.provider_icon);
val providerIcon = itemView.findViewById<ImageView>(R.id.provider_icon)
val text = itemView.findViewById<CheckedTextView>(android.R.id.text1)!!.apply {
setOnClickListener(this@Holder)
val tintList = ColorStateList.valueOf(context.omegaPrefs.accentColor)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GoogleSearchProvider(context: Context) : SearchProvider(context) {
val launcher = OmegaLauncher.getLauncher(context)
if (launcher.googleNow != null) {
//TODO OPEN GOOGLE FEED.
launcher.googleNow!!.showOverlay(true);
launcher.googleNow!!.showOverlay(true)
} else {
callback(Intent(Intent.ACTION_MAIN).setClassName(PACKAGE, "$PACKAGE.SearchActivity"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class SettingsSearchView(context: Context, attrs: AttributeSet?) : SearchView(co
private var customTypeface: Typeface? = null

init {
isIconified = false;
isIconified = false
}

fun setTypeface(typeface: Typeface) {
Expand Down
2 changes: 1 addition & 1 deletion Omega/src/com/saggitt/omega/theme/ThemeManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class ThemeManager(val context: Context) : WallpaperColorInfo.OnChangeListener,

BlankActivity.requestPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION,
REQUEST_PERMISSION_LOCATION_ACCESS) { granted ->
if (granted as Boolean) {
if (granted) {
listenToTwilight = true
} else {
prefs.launcherTheme = theme.removeFlag(THEME_DARK_MASK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,8 @@ private boolean shouldScrollStart(MotionEvent ev, int pointerIndex) {
}

// Check if the client is interested in scroll in current direction.
if (((mScrollConditions & DIRECTION_NEGATIVE) > 0 && mDisplacement > 0) ||
((mScrollConditions & DIRECTION_POSITIVE) > 0 && mDisplacement < 0)) {
return true;
}
return false;
return ((mScrollConditions & DIRECTION_NEGATIVE) > 0 && mDisplacement > 0) ||
((mScrollConditions & DIRECTION_POSITIVE) > 0 && mDisplacement < 0);
}

public boolean onTouchEvent(MotionEvent ev) {
Expand Down

0 comments on commit 5806038

Please sign in to comment.