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 RestaurantsMapActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
AndroidInjection.inject(this) | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_restaurants_map) | |
// ... | |
} | |
} |
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
@Module | |
abstract class BuildersModule { | |
@ContributesAndroidInjector | |
abstract fun contributeRestaurantsMapActivity(): RestaurantsMapActivity | |
} |
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
override fun onMapLoaded() { | |
restaurantsViewModel.restaurants | |
.observe(this, Observer<Resource<List<Restaurant>>> { resource -> | |
when (resource?.status) { | |
Resource.Status.SUCCESS -> { | |
hideLoading() | |
if (resource.data != null && resource.data.isNotEmpty()) { | |
showMarkers(resource.data) | |
} |
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 com.cornershopapp.shopper.android.utils; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.text.style.ReplacementSpan; | |
import com.cornershopapp.shopper.android.R; | |
/** |
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
for i in {1..5} | |
do | |
adb shell settings put global airplane_mode_on 1 | |
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true | |
sleep $(( ( RANDOM % 10 ) + 10 )) | |
adb shell settings put global airplane_mode_on 0 | |
adb shell am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false | |
sleep $(( ( RANDOM % 10 ) + 10 )) | |
done |
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
/** | |
* Fetches how many bytes have been downloaded so far and updates ProgressBar | |
*/ | |
class DownloadProgressCounter extends Thread { | |
private final long downloadId; | |
private final DownloadManager.Query query; | |
private Cursor cursor; | |
private int lastBytesDownloadedSoFar; | |
private int totalBytes; |
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
/// | |
///Your adapter code | |
/// | |
public View getView(int position, View convertView, ViewGroup parent) { | |
//example of usage | |
//let holder.image be some ImageView, mContentUri some video file Uri | |
new VideoThumbnailLoader(getContext(), holder.image, MediaStore.Images.Thumbnails.MICRO_KIND).execute(mContentUri); | |
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 android.content.Context; | |
import android.hardware.Camera; | |
import android.util.Log; | |
import android.view.SurfaceHolder; | |
import android.view.SurfaceView; | |
import java.io.IOException; | |
import java.util.List; | |
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback { |
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 com.test.app; | |
import com.test.app.R; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.widget.CompoundButton; |
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 com.test.app.widgets; | |
import java.util.ArrayList; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Path; | |
import android.util.AttributeSet; |