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
btnThree.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
modelArrayList.clear(); | |
modelArrayList.add(new Model(R.drawable.what_hot)); | |
modelArrayList.add(new Model(R.drawable.what_hot)); | |
modelArrayList.add(new Model(R.drawable.what_hot)); | |
setSpanValue(); | |
} |
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
private void setSpanValue() { | |
StaggeredGridLayoutManager staggeredGridLayoutManager; | |
if (modelArrayList.size() == 1) { | |
staggeredGridLayoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL); | |
recyclerView.setLayoutManager(staggeredGridLayoutManager); | |
} else if (modelArrayList.size() == 2) { | |
staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL); | |
recyclerView.setLayoutManager(staggeredGridLayoutManager); | |
} else { | |
staggeredGridLayoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.HORIZONTAL); |
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
private boolean checkEvenOrOdd(int n) { | |
if ((n % 2) == 0) { | |
// number is even | |
return true; | |
} else { | |
// number is odd | |
return false; | |
} | |
} |
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
private void setupValuesInWidgets(MyViewHolder itemHolder, | |
Model settingsModel, int pos) { | |
if (settingsModel != null) { | |
itemHolder.ivLogo.setBackgroundResource(settingsModel.getImage()); | |
itemHolder.ivLogo.getLayoutParams().height = getPixelFromDips(mContext, SMALL_BOX_HEIGHT_IN_DP); | |
if (modelArrayList.size() == SIZE_1) { | |
cellForItemOne(itemHolder); | |
} else { | |
if (isEven) { |
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
LocationRequest locationRequest = LocationRequest.create(); | |
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); | |
locationRequest.setInterval(10000); | |
locationRequest.setFastestInterval(10000 / 2); | |
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest); |
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
Task<LocationSettingsResponse> result = LocationServices.getSettingsClient(this) | |
.checkLocationSettings(builder.build()); |
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
result.addOnCompleteListener(new OnCompleteListener<LocationSettingsResponse>() { | |
@Override | |
public void onComplete(@NonNull Task<LocationSettingsResponse> task) { | |
try { | |
LocationSettingsResponse response = task.getResult(ApiException.class); | |
// All location settings are satisfied. The client can initialize location | |
// requests here. | |
setupLocationListener(); | |
} catch (ApiException exception) { |
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 MyInstanceIDListenerService extends FirebaseMessagingService { | |
} |
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 final class AppConstant { | |
public static final int MINIMUM_NUMBER = 4; | |
} |
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 MeActivity extends BaseActivity { | |
private static final String TAG = MeActivity.class.getSimpleName(); | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
int number=AppConstant.MINIMUM_AGE; | |
Log.d(TAG, "onCreate: " + number); |