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
sudo add-apt-repository ppa:mysteriumnetwork/node | |
sudo apt-get update | |
sudo apt install myst | |
sudo apt install firewalld | |
sudo firewall-cmd --zone=public --permanent --add-port=80/tcp | |
sudo firewall-cmd --reload | |
sudo iptables-save > ~/iptables-rules | |
sudo iptables -P INPUT ACCEPT | |
sudo iptables -P OUTPUT ACCEPT | |
sudo iptables -P FORWARD ACCEPT |
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
// in where ever you want | |
resultManager.sendResult(args.requestCode, result) | |
controller.popBackStack() | |
// in case you don't want to send back the result | |
// cancel the request for result | |
override fun onCleared() { | |
super.onCleared() | |
resultManager.cancel(requestCode = args.requestCode) | |
} |
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
// in ViewModel | |
viewModelScope.launch(Dispatchers.IO) { | |
val result = resultManager.getResult<FormatOption>(requestCode) | |
// process result | |
} | |
// in Activity/Fragment/View | |
val args = SelectFormatFragmentArgs(UUID.randomUUID().toString()) | |
findNavController().navigate(R.id.select_format, args.toBundle()) |
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
@Singleton | |
class ResultManager @Inject constructor() { | |
private val requests = HashMap<String, CancellableContinuation<*>>() | |
suspend fun <T> getResult(requestCode: String): T = suspendCancellableCoroutine { continuation -> | |
requests[requestCode] = continuation | |
continuation.invokeOnCancellation { | |
requests.remove(requestCode) | |
} |
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
import android.content.Context | |
import android.util.Log | |
import androidx.work.Worker | |
import androidx.work.WorkerParameters | |
import dagger.android.ContributesAndroidInjector | |
import dagger.android.HasAndroidInjector | |
import javax.inject.Inject | |
object ContextInjection { |
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
import com.cloudbees.hudson.plugins.folder.AbstractFolder | |
import hudson.model.AbstractItem | |
import groovy.transform.Field | |
def jobName = "Android-Verify" // jobName can be set to a Job or a Folder. If a folder, it will clean all jobs in that folder | |
//jobName should be full job name from root if mutliple levels down(for example "Folder1/Folder2/Job") | |
def resetBuildNumber = false // If this is true, the build number will be set back to 1 | |
@Field def dryRun = false // If this is true, the job will run without deletion. | |
@Field def cleanedJobsTotal = 0 | |
@Field def keepDays = 0 // Days to keep. |
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
@Module | |
interface HomeActivityModule { | |
@ContributesAndroidInjector | |
fun activity(): HomeActivity | |
} |
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
// real source | |
package com.nlgtuankiet.modularization.home | |
import dagger.Module | |
import dagger.android.ContributesAndroidInjector | |
@Module | |
interface HomeActivityModule { | |
@ContributesAndroidInjector | |
fun activity(): HomeActivity |
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
// app/build.gradle | |
def include(moduleName) { | |
if (hasProperty('only')) { | |
return only.split(",").contains(moduleName) | |
} | |
return true | |
} | |
android { | |
sourceSets { | |
if (project.hasProperty("only")) { |
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
// :app | |
@Singleton | |
@Component( | |
modules = [ | |
AndroidSupportInjectionModule::class, | |
HomeActivityModule::class, | |
DetailActivityModule::class, | |
SearchActivityModule::class | |
] | |
) |
NewerOlder