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 class MapsActivity extends FragmentActivity implements OnMapReadyCallback, LocationListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { | |
private GoogleMap mMap; | |
private GoogleApiClient mGoogleApiClient; | |
private static final String TAG = MapsActivity.class.getSimpleName(); | |
private final int REQUEST_PERMISSION_PHONE_STATE = 1; | |
private LocationRequest mLocationRequest; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { |
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
GlideApp.with(this) | |
.load(url) | |
.into(activityFirstBinding.ivImage1); |
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
Glide.with(this) | |
.load(url) | |
.into(activityFirstBinding.ivImage1); |
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
@GlideModule | |
public class SampleAppGlideModule extends AppGlideModule { | |
@Override | |
public void applyOptions(Context context, GlideBuilder builder) { | |
int memoryCacheSizeBytes = 1024 * 1024 * 20; // 20mb | |
builder.setMemoryCache(new LruResourceCache(memoryCacheSizeBytes)); | |
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, memoryCacheSizeBytes)); | |
builder.setDefaultRequestOptions(requestOptions(context)); | |
builder.build(context); |
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
@GlideModule | |
public class YourAppGlideModule extends AppGlideModule { | |
@Override | |
public void registerComponents(Context context, Glide glide, Registry registry) { | |
registry.append(...); | |
} | |
} |
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
@GlideModule | |
public class YourAppGlideModule extends AppGlideModule { | |
@Override | |
public void applyOptions(Context context, GlideBuilder builder) { | |
MemorySizeCalculator calculator = new MemorySizeCalculator.Builder(context) | |
.setMemoryCacheScreens(2) | |
.build(); | |
builder.setMemoryCache(new LruResourceCache(calculator.getMemoryCacheSize())); | |
} | |
} |
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
@GlideModule | |
public final class OkHttpLibraryGlideModule extends LibraryGlideModule { | |
@Override | |
public void registerComponents(Context context, Glide glide, Registry registry) { | |
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory()); | |
} | |
} |
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 class MapsFragment extends Fragment implements OnMapReadyCallback { | |
@Override | |
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
// Inflate the layout for this fragment | |
View rootView = inflater.inflate(R.layout.fragment_maps, container, false); | |
SupportMapFragment mapFragment = (SupportMapFragment) this.getChildFragmentManager(). | |
findFragmentById(R.id.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
SampleClazz.displayText(mActivityMainBinding, new IViewTouchListener() { | |
@Override | |
public void onTouched(String text) { | |
Toast.makeText(MainActivity.this, text, Toast.LENGTH_LONG).show(); | |
} | |
}); |
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 class SampleClazz { | |
public static void displayText(ActivityMainBinding activityMainBinding, IViewTouchListener iViewTouchListener){ | |
activityMainBinding.setVariable(BR.touchListener, iViewTouchListener); | |
activityMainBinding.executePendingBindings(); | |
iViewTouchListener.onTouched("Demo text"); | |
} | |
} |