Skip to content

Instantly share code, notes, and snippets.

View WrathChaos's full-sized avatar
❤️‍🔥
Working Hard

FreakyCoder WrathChaos

❤️‍🔥
Working Hard
View GitHub Profile
@WrathChaos
WrathChaos / TransparentStatusBar.md
Last active December 28, 2019 12:56
The easiest way to make status bar transparent in android
@OnCreate
{
  // FullScreen
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, 
  WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
// XML : 
@WrathChaos
WrathChaos / android-portait-mode.md
Last active March 23, 2021 11:16
Portrait Mode Only in Android
<activity
 android:name=".MainActivity"
 android:label="@string/app_name"
 android:configChanges="orientation"
 android:screenOrientation="portrait"
>
@WrathChaos
WrathChaos / CircleImageView.md
Last active December 14, 2019 16:05
How to circle ImageView in Java
// Circle ImageView Function (Could be custom rounded)
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap
            .getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
// string.xml PART
<string name="name0">Kuray OGUN</string>
<string name="nickname">FreakyCoder</string>

// In JAVA, getting the strings from string.xml
String name = getResources().getString(R.string.name0);
String nickname = getResources().getString(R.string.nickname);
// Prevent to auto popping keyboard
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
@WrathChaos
WrathChaos / recyclerview.md
Last active November 21, 2021 19:23
Android: How to remove recyclerView scroll effect?
// How to close scrollMode in RecyclerView
<android.support.v7.widget.RecyclerView
   android:id="@+id/ssm_recyclerView"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:overScrollMode="never" 
/>
@WrathChaos
WrathChaos / How to set delay
Created November 2, 2015 11:14
Calling functions after a delay.
//Here's a runnable/handler combo
Runnable mMyRunnable = new Runnable()
{
@Override
public void run()
{
//Your function or code segment will be here !
}
};
@WrathChaos
WrathChaos / Java Country List
Created November 10, 2015 18:45
ISO Country List, How to get all country names
//Initializing Country List
final List<Country> countryList=new ArrayList<>();
public void fillCountryList(){
String[] countries = Locale.getISOCountries();
int j = 0;
// Loop each country
for(int i = 0; i < countries.length; i++) {
@WrathChaos
WrathChaos / How to getText from CustomListView
Created November 11, 2015 14:51
How to getText from CustomListView's TextView by setOnClickListener
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TextView tv = (TextView) view.findViewById(R.id.country_name);
String country = tv.getText().toString();
}
}
public class ColorfulSnackbar {
    
    private static final int red = Color.parseColor("#f41515");
    private static final int green = 0xff4caf50;
    private static final int blue = 0xff2195f3;
    private static final int orange = 0xffffc107;
    private static final int myBlue = Color.parseColor("#002487");

    private static View getSnackBarLayout(Snackbar snackbar) {