-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented "Scheduled Rules" feature (#8)
Implemented "Deactivate Apps" feature Improved app list (show app categories, when available) Improved install instructions (#21) UI tweaks Removed GitReports feature (service is offline) Updated Android framework libraries
- Loading branch information
Showing
44 changed files
with
1,005 additions
and
247 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
22 changes: 0 additions & 22 deletions
22
app/src/androidTest/java/com/flx_apps/digitaldetox/ExampleInstrumentedTest.kt
This file was deleted.
Oops, something went wrong.
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
49 changes: 49 additions & 0 deletions
49
app/src/main/java/com/flx_apps/digitaldetox/CloseableBottomSheetDialogFragment.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,49 @@ | ||
package com.flx_apps.digitaldetox | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.LinearLayout | ||
import androidx.fragment.app.Fragment | ||
import com.google.android.material.bottomsheet.BottomSheetBehavior | ||
import com.google.android.material.bottomsheet.BottomSheetDialog | ||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment | ||
import com.google.android.material.button.MaterialButton | ||
|
||
/** | ||
* Creation Date: 1/19/22 | ||
* @author felix | ||
*/ | ||
open class CloseableBottomSheetDialogFragment(var contentFragment: Fragment) : BottomSheetDialogFragment() { | ||
val viewId = View.generateViewId() | ||
|
||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||
return LinearLayout(requireContext()).apply { | ||
layoutParams = LinearLayout.LayoutParams( | ||
LinearLayout.LayoutParams.MATCH_PARENT, | ||
LinearLayout.LayoutParams.MATCH_PARENT | ||
) | ||
orientation = LinearLayout.VERTICAL | ||
id = viewId | ||
} | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
// init close button for the dialog | ||
val closeButton = MaterialButton(view.context, null, R.attr.borderlessButtonStyle).apply { | ||
layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT) | ||
text = getText(R.string.action_close) | ||
setOnClickListener { dialog!!.dismiss() } | ||
} | ||
|
||
(dialog as BottomSheetDialog).behavior.state = BottomSheetBehavior.STATE_EXPANDED | ||
childFragmentManager | ||
.beginTransaction() | ||
.add(viewId, contentFragment) | ||
.runOnCommit { (view as LinearLayout).addView(closeButton) } | ||
.commit() | ||
} | ||
} |
Oops, something went wrong.