Skip to content

Instantly share code, notes, and snippets.

View haxzie-xx's full-sized avatar
👨‍💻
at work

Musthaq Ahamad haxzie-xx

👨‍💻
at work
View GitHub Profile
public class FullScreenDialog extends DialogFragment {
public static String TAG = "FullScreenDialog";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.FullScreenDialogStyle);
}
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null) {
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width, height);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreateView(inflater, container, savedInstanceState);
View view = inflater.inflate(R.layout.layout_full_screen_dialog, container, false);
Toolbar toolbar = view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp);
toolbar.setNavigationOnClickListener(view1 -> cancelUpload());
toolbar.setTitle("My Dialog");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NORMAL, R.style.FullScreenDialogStyle);
}
<style name="FullScreenDialogStyle" parent="Theme.AppCompat.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorPrimary">@color/colorPrimary</item>
<!-- Set this to true if you want Full Screen without status bar -->
<item name="android:windowFullscreen">false</item>
<item name="android:windowIsFloating">false</item>
@haxzie-xx
haxzie-xx / layout_full_screen_dialog.xml
Last active March 31, 2019 12:44
mediun-full-screen-dialogs
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
@haxzie-xx
haxzie-xx / gatsby-node.js
Created January 19, 2019 18:29
Interacting with Gatsby's node APIs to generate pages from Markdown files
const path = require("path")
exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions
const blogPostTemplate = path.resolve(`src/templates/blog_template.js`)
return graphql(`
@haxzie-xx
haxzie-xx / blog_template.js
Created January 19, 2019 18:24
Gatsby blog post template
import React from 'react'
import { graphql } from 'gatsby'
import Layout from '../components/layout'
const BlogPostTemplate = ({ data }) => {
// extract the contents from data
const { markdownRemark } = data;
const { frontmatter, html } = markdownRemark;
@haxzie-xx
haxzie-xx / index.js
Created January 19, 2019 18:09
Gatsby blog home page
import React from 'react'
import { Link, graphql } from 'gatsby'
import Layout from '../components/layout'
/** ================= This is the function to extract data ===================
* Function to create a list of <h1> elements with Post title
* @param {*} data
*/
@haxzie-xx
haxzie-xx / gatsby-config.js
Created January 19, 2019 17:20
Gatsby-blog-tutorial
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,