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
//Given width and height of a rectangle which is rotated from center by angle in radians, | |
//returns width and height of rectangle to crop from center of original image to eliminate the black borders | |
// https://i.stack.imgur.com/KWoeo.jpg | |
//Similar to this image above,input params are input's width and height,rotation in radians | |
//Output is pair.first = width of cropped image in B, pair.second = height of cropped image in B | |
//You can use the scaleCenterCrop function to crop the image bitmap on android | |
// Usage: | |
// Pair<Integer, Integer> pair = rotatedRectWithMaxArea(originalImageWidth, originalImageHeight, Math.toRadians(rotation)); |
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
How to fix errors while uploading themes on wordpress site (Ubuntu NGINX LEMP) | |
[Useful nano shortcut] | |
Search: CTRL + W | |
Save file: CTRL + X | |
1.Fix "413 Request Entity Too Large" Error | |
sudo nano /etc/nginx/nginx.conf | |
Add a line in the http section: |
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
Enabling Hibernate | |
[https://kaigo.medium.com/ubuntu-20-04-on-dell-xps-15-9570-14efd881f0d2] | |
Install gparted from Ubuntu Software Centre | |
Find the partition with the file system linux-swap | |
Right click > Swapon (if not already on) | |
Right click > Information | |
Copy the UUID=14cee2ec-9d37–4ac0-b594-eae0e55814aa (for example) | |
Add this UUID to /etc/default/grub file by running sudo gedit /etc/default/grub and editing the line |
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 MovieService() { | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl(URL) | |
.client(new OkHttpClient.Builder().addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)).build()) | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build(); | |
mMovieApi = retrofit.create(MovieApi.class); | |
} |
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
<provider | |
android:name=".GenericFileProvider" | |
android:authorities="${applicationId}" | |
android:exported="false" | |
android:grantUriPermissions="true"> | |
<meta-data | |
android:name="android.support.FILE_PROVIDER_PATHS" | |
android:resource="@xml/provider_paths"/> | |
</provider> |
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
<!-- <string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>--> | |
<!-- String text = res.getString(R.string.welcome_messages, username, mailCount);--> | |
<!-- <plurals name="welcome_messages">--> | |
<!-- <item quantity="one">Hello, %1$s! You have a new message.</item>--> | |
<!-- <item quantity="other">Hello, %1$s! You have %2$d new messages.</item>--> | |
<!-- </plurals>--> | |
<!-- String text = getResources().getQuantityString(R.plurals.welcome_messages, mailCount, username, mailCount);--> | |
<!-- %[parameter_index$][format_type]--> |
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
public static ArrayList<ArrayList<String>> getKeyEvents() { | |
return new ArrayList<ArrayList<String>>() { | |
{ | |
add(new ArrayList<String>() {{ | |
add("UNKNOWN"); | |
add("0"); | |
}}); | |
add(new ArrayList<String>() {{ | |
add("SOFT_LEFT"); |
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
// Just pass context and list of file | |
// It will create a PDF file in cache dir | |
// Add your own logic to share/open PDF | |
// Works fast and reliable method | |
// > - No library needed (Uses android internal android.graphics.pdf.PdfDocument classes) | |
// > - Works in background, Doesn''t freeze UI | |
// > - No need to declare and grant storage permission :) | |
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
public class BaseActivity extends FragmentActivity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
IronSource.init(this, AppConfig.IRONSOURCE_APP_KEY); | |
... | |
} | |
} |
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
interface MFlow<T>{ | |
fun collect(collector: MCollector<T>) | |
} | |
interface MCollector<T>{ | |
fun onEmit(item :T) | |
} | |
// fun mFlowOf(value: String):MFlow<String>{ |
OlderNewer