This file contains hidden or 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
| public abstract class BaseRxMonoBehaviour : BaseMonoBehaviour | |
| { | |
| protected virtual void SubscribeWithProgress<T>(Observable<T> observable, Action<T> onNext = null, | |
| Action<Exception> onError = null, Action<Result> onCompleted = null, | |
| Action onShowProgress = null, Action onHideProgress = null) | |
| { | |
| Timber.D("BaseRxMonoBehaviour.SubscribeWithProgress") | |
| Subscribe( |
This file contains hidden or 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
| class InfoContainerFragment : | |
| BaseBindingFragment<FragmentInfoContainerBinding, InfoContainerViewModel>(R.layout.fragment_info_container) { | |
| override fun getViewModelClass() = InfoContainerViewModel::class | |
| private var downloadManager: DownloadManager? = null | |
| private val onCompleteDownloadReceiver: BroadcastReceiver = object : BroadcastReceiver() { | |
| override fun onReceive(ctxt: Context, intent: Intent) { | |
| hideProgress() |
This file contains hidden or 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
| int productOfDigits(int number) { | |
| String numberStr = Integer.toString(number); | |
| int result = 1; | |
| for (int i = 0; i < numberStr.length(); i++) { | |
| int num = Integer.parseInt(Character.toString(numberStr.charAt(i))); | |
| result *= num; | |
| } | |
| return result; | |
| } |
This file contains hidden or 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
| fun scanFiles() { | |
| val files: MutableList<String> = ArrayList() | |
| val contentResolver = context.contentResolver | |
| val uri = MediaStore.Files.getContentUri("internal") | |
| val projection: Array<String>? = null | |
| val selection = MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" |
This file contains hidden or 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
| class TrackInformationFragment : | |
| BaseFragment<TrackInformationViewModel>(R.layout.fragment_track_information) { | |
| private val args: TrackInformationFragmentArgs by navArgs() | |
| override val model: TrackInformationViewModel by viewModel() | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| val filesTextView = view.findView<TextView>(R.id.filesTextView) |
This file contains hidden or 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
| class MainActivity : BaseActivity() { | |
| private val model: MainViewModel by viewModels() | |
| private val userAdapter = UserAdapter() | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) |
This file contains hidden or 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
| class CacheControlInterceptor @Inject constructor(private val context: Context) : Interceptor { | |
| override fun intercept(chain: Interceptor.Chain): Response { | |
| val modifyRequest = modifyRequest(chain.request()) | |
| val response = chain.proceed(modifyRequest) | |
| return response | |
| } | |
| private fun modifyRequest(originRequest: Request) = | |
| if (context.isNetworkAvailable()) { |
This file contains hidden or 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 java.util.*; | |
| import java.io.*; | |
| public class Test { | |
| public static void main(String[] args)throws Exception{ | |
| FileReader reader=new FileReader("db.properties"); | |
| Properties p=new Properties(); | |
| p.load(reader); | |
| System.out.println(p.getProperty("user")); |
This file contains hidden or 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
| public static void setAppAsSystem(String name, boolean system) throws Exception | |
| { | |
| Process p = Runtime.getRuntime().exec("su -c sh"); | |
| final BufferedInputStream bis = new BufferedInputStream(p.getInputStream()); | |
| new Thread(new Runnable() { | |
| @Override | |
| public void run() { | |
| int ch = 0; | |
| try { |
This file contains hidden or 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
| package model.entity; | |
| public class Car { | |
| String brand; | |
| String model; | |
| int color; |
NewerOlder