Skip to content

Commit

Permalink
fix: fix some code analysis warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Bambooin committed Feb 21, 2024
1 parent 17af91b commit c7bfa78
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,8 @@ class AppsRecyclerAdapter(
)
}
holder.txtTitle.text = rowItem.label

holder.packageName.text = rowItem.packageName
holder.packageName.isSelected = true // for marquee

val enableMarqueeFilename =
(fragment.requireActivity() as MainActivity)
.getBoolean(PreferencesConstants.PREFERENCE_ENABLE_MARQUEE_FILENAME)
Expand All @@ -205,8 +203,6 @@ class AppsRecyclerAdapter(
}
marqueeAfterDelay(2000, holder.txtTitle)
}

// File f = new File(rowItem.getDesc());
if (!isBottomSheet) {
holder.txtDesc.text = rowItem.fileSize + " |"
}
Expand Down Expand Up @@ -311,11 +307,7 @@ class AppsRecyclerAdapter(
) {
context = ContextThemeWrapper(context, R.style.overflow_black)
}
val popupMenu =
PopupMenu(
context,
view,
)
val popupMenu = PopupMenu(context, view)
popupMenu.setOnMenuItemClickListener { item: MenuItem ->
val themedActivity: MainActivity = fragment.requireActivity() as MainActivity
val colorAccent = themedActivity.accent
Expand Down Expand Up @@ -349,10 +341,7 @@ class AppsRecyclerAdapter(
Intent(
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
Uri.parse(
String.format(
"package:%s",
rowItem!!.packageName,
),
String.format("package:%s", rowItem!!.packageName),
),
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ class ZipService : AbstractProgressiveService() {
.utilsProvider
.colorPreference
.getCurrentUserColorPreferences(this, sharedPreferences).accent

val notificationIntent =
Intent(this, MainActivity::class.java)
.putExtra(MainActivity.KEY_INTENT_PROCESS_VIEWER, true)
Expand All @@ -118,10 +117,8 @@ class ZipService : AbstractProgressiveService() {
notificationIntent,
getPendingIntentFlag(0),
)

customSmallContentViews = RemoteViews(packageName, R.layout.notification_service_small)
customBigContentViews = RemoteViews(packageName, R.layout.notification_service_big)

val stopIntent = Intent(KEY_COMPRESS_BROADCAST_CANCEL)
val stopPendingIntent =
PendingIntent.getBroadcast(
Expand All @@ -147,7 +144,6 @@ class ZipService : AbstractProgressiveService() {
.addAction(action)
.setOngoing(true)
.setColor(accentColor)

NotificationConstants.setMetadata(this, mBuilder, NotificationConstants.TYPE_NORMAL)
startForeground(NotificationConstants.ZIP_ID, mBuilder.build())
initNotificationViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,12 @@ object FileProperties {
}
}

/**
* Remap file path
* @param path file path
* @param openDocumentTree open document tree default false
* @return remapped file path
*/
@JvmStatic
fun remapPathForApi30OrAbove(
path: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ object MakeFileOperation {
return File(extDir, file.name)
}

/**
* Make normal file
* @param file File
* @param context Context
* @return true for success and false for failed
*/
@JvmStatic
fun mkfile(
file: File?,
Expand Down Expand Up @@ -97,6 +103,13 @@ object MakeFileOperation {
}
}

/**
* Make text file
* @param data file data
* @param path path
* @param fileName file name
* @return true for success and false for failed
*/
@JvmStatic
fun mktextfile(
data: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ object RenameOperation {
var outChannel: FileChannel? = null
try {
inStream = FileInputStream(source)

// First try the normal way
if (FileProperties.isWritable(target)) {
// standard way
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ class DrawerViewModel : ViewModel() {
return requireNotNull(menuMetadataMap[item.toNonLeaking()])
}

/**
* Put drawer meta data
* @param item menu item
* @param metadata menu meta data
*/
fun putDrawerMetadata(
item: MenuItem,
metadata: MenuMetadata,
Expand Down

0 comments on commit c7bfa78

Please sign in to comment.