Skip to content

Instantly share code, notes, and snippets.

💭
null

Cüneyt Çarıkçi Cutta

💭
null
Block or report user

Report or block Cutta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Kotlin_FromHtml
fun String.toSpanned(): Spanned {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return Html.fromHtml(this, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION")
return Html.fromHtml(this)
}
}
View FragmentManagerExtensionFunction
fun FragmentManager.show(containerId: Int, fragment: Fragment, backstack: String? = null) {
beginTransaction()
.replace(containerId, fragment)
.addToBackStack(backstack)
.commit()
}
View AndroidShowKeyboardProgrammatically
public static void showKeyboard(final Activity activity, final View view) {
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInputFromWindow(
view.getApplicationWindowToken(),
InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
}
@Cutta
Cutta / NavigationVisibility
Created Dec 20, 2016
Set visibility of Navigation bar
View NavigationVisibility
private void showHideChrome(boolean show) {
int flags = show ? 0 : View.SYSTEM_UI_FLAG_LOW_PROFILE;
flags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
if (!show) {
flags |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE;
}
@Cutta
Cutta / ExtractSVGPath.ruby
Last active Sep 5, 2016
Extracts and displays SVG Path path from your .svg file
View ExtractSVGPath.ruby
require 'nokogiri'
File.open("/your/file/path/test.svg", "r") do |f|
@doc = Nokogiri::XML(f)
puts "\n\n\n"
puts @doc.css("path").first.attr("d")
puts "\n\n\n"
end
@Cutta
Cutta / MakeBlurr.java
Last active Aug 10, 2016
Android ImageView Blurring
View MakeBlurr.java
public void makeBlur(ImageView imageview) {
BitmapDrawable drawable = (BitmapDrawable) imageview.getDrawable();
Bitmap bitmap = drawable.getBitmap();
textView.setText("Radius: " + "" + radiusArr[position]);
Bitmap blurred = blurRenderScript(bitmap, 25); //second parametre is radius max:25
imageview.setImageBitmap(blurred); //radius decide blur amount
}
@SuppressLint("NewApi")
private Bitmap blurRenderScript(Bitmap smallBitmap, int radius) {
You can’t perform that action at this time.