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
open class BaseBottomTabFragment : Fragment() { | |
var isNavigated = false | |
fun navigateWithAction(action: NavDirections) { | |
isNavigated = true | |
findNavController().navigate(action) | |
} | |
fun navigate(resId: Int) { | |
isNavigated = true |
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
private class MyAsyncTask extends AsyncTask<String, Void, int> { | |
protected void onPreExecute() { | |
// Ön hazırlık - UI threadinde çalışır. | |
} | |
protected int doInBackground(Void… param) { | |
// Network çağrısını burada yap. | |
} | |
protected void onProgressUpdate(String… values) { |
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
private Handler handler = new Handler() { | |
@Override | |
public void handleMessage(Message msg) { | |
// UI'i burada güncelle. | |
} | |
} | |
Runnable runnable = new Runnable() { | |
public void run() { | |
// Burada network çağrısı yapılır. |
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
Runnable runnable = new Runnable() { | |
public void run() { | |
// Burada network çağrısı yapılır. | |
} | |
}; | |
Thread mythread = new Thread(runnable); | |
mythread.start(); |
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
class PodcastFragment : BaseFragment<PodcastViewModel, FragmentPodcastBinding>(PodcastViewModel::class.java) { | |
private val podcastFragmentArgs: PodcastFragmentArgs by navArgs() | |
override fun init() { | |
super.init() | |
fun getData() { | |
viewModel.getEpisodes(podcastFragmentArgs.podcastID) | |
viewModel.podcastLiveData.observe( | |
viewLifecycleOwner, |
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
val adapter = BestPodcastsAdapter { item -> | |
val podcastId = item.id | |
val action = HomeFragmentDirections.actionHomeFragmentToPodcastFragment().setPodcastID(podcastId ?: "") | |
findNavController().navigate(action) | |
} |