Simple Horizontal Divider Item Decoration for RecyclerView
mRecyclerView.addItemDecoration(new SimpleDividerItemDecoration(
getApplicationContext()
));
NOTE: Add item decoration prior to setting the adapter
package info.piwai.android; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.text.SpannableStringBuilder; | |
import android.text.Spanned; | |
import android.util.AttributeSet; | |
import android.util.Log; |
package se.marteinn.ui; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.widget.ScrollView; | |
/** | |
* Triggers a event when scrolling reaches bottom. |
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="ru.artzmb.solar.MainActivity"> | |
<ImageView |
static var httpClient = new HttpClient(); | |
Future<File> _downloadFile(String url, String filename) async { | |
var request = await httpClient.getUrl(Uri.parse(url)); | |
var response = await request.close(); | |
var bytes = await consolidateHttpClientResponseBytes(response); | |
String dir = (await getApplicationDocumentsDirectory()).path; | |
File file = new File('$dir/$filename'); | |
await file.writeAsBytes(bytes); | |
return file; | |
} |
public class LogOutTimerUtil { | |
public interface LogOutListener { | |
void doLogout(); | |
} | |
static Timer longTimer; | |
static final int LOGOUT_TIME = 600000; // delay in milliseconds i.e. 5 min = 300000 ms or use timeout argument | |
public static synchronized void startLogoutTimer(final Context context, final LogOutListener logOutListener) { |
//View container.. | |
View rootView = inflater.inflate(R.layout.fragment1, container, false); | |
//Global WebView | |
mWebView = (WebView) rootView.findViewById(R.id.enter_text); | |
//Font must be placed in assets/fonts folder | |
String text = "<html><style type='text/css'>@font-face { font-family: spqr; src: url('fonts/spqr.ttf'); } body p {font-family: spqr;}</style>" | |
+ "<body >" + "<p align=\"justify\" style=\"font-size: 22px; font-family: spqr;\">" + getString(R.string.enter_text) + "</p> "+ "</body></html>"; |
class Converter{ | |
public static void main(String[] args) { | |
System.out.println(getSize(1048576)); | |
} | |
public static String getSize(long size) { | |
long n = 1024; | |
String s = ""; | |
double kb = size / n; | |
double mb = kb / n; | |
double gb = mb / n; |
#dart:convert example
How to pretty-print JSON using Dart.
How to display JSON in an easy-to-read (for human readers) format.
Main library: dart:convert
Main element: JsonEncoder.withIndent
Gist: https://gist.github.com/kasperpeulen/d61029fc0bc6cd104602