-
-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
104 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/MyViewPagerFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.simplemobiletools.filemanager.pro.fragments | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.widget.RelativeLayout | ||
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity | ||
|
||
abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet) : RelativeLayout(context, attributeSet) { | ||
abstract fun setupFragment(activity: SimpleActivity) | ||
|
||
abstract fun setupColors(textColor: Int, adjustedPrimaryColor: Int) | ||
|
||
abstract fun setupFontSize() | ||
|
||
abstract fun setupDateTimeFormat() | ||
} |
52 changes: 39 additions & 13 deletions
52
app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/RecentsFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,43 @@ | ||
package com.simplemobiletools.filemanager.pro.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.fragment.app.Fragment | ||
import com.simplemobiletools.filemanager.pro.R | ||
|
||
class RecentsFragment : Fragment() { | ||
lateinit var mView: View | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { | ||
mView = inflater.inflate(R.layout.recents_fragment, container, false)!! | ||
return mView | ||
import android.content.Context | ||
import android.provider.MediaStore | ||
import android.util.AttributeSet | ||
import com.simplemobiletools.commons.extensions.getIntValue | ||
import com.simplemobiletools.commons.extensions.getStringValue | ||
import com.simplemobiletools.commons.models.FileDirItem | ||
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity | ||
import com.simplemobiletools.filemanager.pro.interfaces.ItemOperationsListener | ||
import java.util.* | ||
|
||
class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerFragment(context, attributeSet), ItemOperationsListener { | ||
override fun setupFragment(activity: SimpleActivity) {} | ||
|
||
override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) {} | ||
|
||
private fun getRecents() { | ||
val uri = MediaStore.Files.getContentUri("external") | ||
val projection = arrayOf(MediaStore.Files.FileColumns.DATA, MediaStore.Files.FileColumns.DATE_MODIFIED) | ||
val sortOrder = "${MediaStore.Files.FileColumns.DATE_MODIFIED} DESC LIMIT 20" | ||
val cursor = context?.contentResolver?.query(uri, projection, null, null, sortOrder) | ||
|
||
cursor?.use { | ||
if (cursor.moveToFirst()) { | ||
do { | ||
val path = cursor.getStringValue(MediaStore.Files.FileColumns.DATA) | ||
val modified = cursor.getIntValue(MediaStore.Files.FileColumns.DATE_MODIFIED) | ||
} while (cursor.moveToNext()) | ||
} | ||
} | ||
} | ||
|
||
override fun refreshItems() {} | ||
|
||
override fun deleteFiles(files: ArrayList<FileDirItem>) {} | ||
|
||
override fun selectedPaths(paths: ArrayList<String>) {} | ||
|
||
override fun setupFontSize() {} | ||
|
||
override fun setupDateTimeFormat() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters