Skip to content

Instantly share code, notes, and snippets.

View notdrone's full-sized avatar
🦊

droan notdrone

🦊
View GitHub Profile
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@notdrone
notdrone / hide_status_bar_and_action_bar
Created February 13, 2015 10:40
Hide status bar and action bar
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//______________________________________________________________
getSupportActionBar().hide();
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
//_______________________________________________________________
@notdrone
notdrone / gradient
Created February 13, 2015 10:50
Adding gradient
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/material_blue_grey_800"
android:endColor="@color/material_deep_teal_500"
android:angle="-45"/>
</shape>
@notdrone
notdrone / toast
Created February 15, 2015 21:27
list clicks and toast
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String text = (String) listView.getItemAtPosition(position);
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(getActivity(), text, duration);
toast.show();
Intent Detail = new Intent(getActivity(),DetailActivity.class).putExtra("key",some_string);
startActivity(Detail);
Bundle intent=getIntent().getExtras();
String message= intent.getString("key");
TextView text=(TextView)rootView.findViewById(R.id.text);
text.setText(message);
@notdrone
notdrone / RestrictedImagView.java
Created August 13, 2015 05:22
Creating a custom view to block image clicks
@Override
public void setOnClickListener ( OnClickListener listener ) {
OnClickListener listnerNew= new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e("DROAN","replace with this log");
}
};
if (!true)
super.setOnClickListener(listener);
@notdrone
notdrone / FirebaseReadWrite.java
Created December 21, 2015 18:22
firebas write/remove methods
setValue() writes/ replces data at the specified path replacig any data
at that path
updateChildren() write to specific childern of a parent node but without overwriting
other child nodes
push() add to list of data a. A unique id is generated by push depending
on the timestamp
runTransaction() used in ase of a counter, when seeralpeople update the same list
public static final String FIREBASE_URL = BuildConig.UNIQUE_FIREBASE_ROOT_URL;
inside gradle.properties, add
UNIQUE_FIREBASE_ROOT_URL=”https://url.com/”
inside build.gradle, add
buildTypes.each{
@notdrone
notdrone / plurals.txt
Created December 30, 2015 06:17
Plurals
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="see_new_update">
<item quantity="one">1 new update</item>
<item quantity="other">%d new updates</item>
</plurals>
</resources>
String quantityString = context.getResources().getQuantityString(R.plurals.see_new_update,
StringUtil.str2Int(feed.getContent()),StringUtil.str2Int(feed.getContent()));