Skip to content

Commit

Permalink
Code cleanup and minor fixes
Browse files Browse the repository at this point in the history
Removed unused imports and properties
Made some properties private for encapsulation
Fixed unresolved references (e.g., BuildConfig)
Simplified 'activity' initialization

removed unused import
  • Loading branch information
Siddheshjondhale committed Dec 24, 2024
1 parent e507d1d commit a0b1f48
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import android.view.Menu
import android.view.MenuItem
import android.widget.EditText
import androidx.activity.OnBackPressedCallback
import androidx.activity.addCallback
import androidx.annotation.CheckResult
import androidx.appcompat.app.AlertDialog
import androidx.core.widget.doAfterTextChanged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class CardTemplateNotetype(
}

private var _templateChanges = ArrayList<Array<Any>>()
var editedModelFileName: String? = null

fun toBundle(): Bundle =
bundleOf(
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/CollectionHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ object CollectionHelper {
*
* @return Absolute path to the AnkiDroid directory in primary shared/external storage
*/
val legacyAnkiDroidDirectory: String
private val legacyAnkiDroidDirectory: String
get() = File(Environment.getExternalStorageDirectory(), "AnkiDroid").absolutePath

/**
Expand Down
3 changes: 0 additions & 3 deletions AnkiDroid/src/main/java/com/ichi2/anki/NoteEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,6 @@ class NoteEditor :
savedInstanceState.putStringArrayList("tags", selectedTags?.let { ArrayList(it) })
}

private val fieldsAsBundleForPreview: Bundle
get() = NoteService.getFieldsAsBundleForPreview(editFields, shouldReplaceNewlines())

// Finish initializing the fragment after the collection has been correctly loaded
private fun setupEditor(col: Collection) {
val intent = requireActivity().intent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract class AppCompatPreferenceActivity<PreferenceHack : AppCompatPreferenceA
fun isColInitialized() = ::col.isInitialized

protected var prefChanged = false
lateinit var unmountReceiver: BroadcastReceiver
private lateinit var unmountReceiver: BroadcastReceiver
protected lateinit var col: Collection
private set
protected lateinit var pref: PreferenceHack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RtlCompliantActionProvider(
context: Context,
) : ActionProviderCompat(context) {
@VisibleForTesting
val activity: Activity
val activity: Activity = unwrapContext(context)

/**
* The action to perform when clicking the associated menu item. By default this delegates to
Expand Down Expand Up @@ -74,8 +74,4 @@ class RtlCompliantActionProvider(
}
}
}

init {
activity = unwrapContext(context)
}
}

0 comments on commit a0b1f48

Please sign in to comment.