Skip to content

Instantly share code, notes, and snippets.

View swanhtet1992's full-sized avatar
🪶
Studying programming again!

Swan Htet Aung swanhtet1992

🪶
Studying programming again!
View GitHub Profile

You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@swanhtet1992
swanhtet1992 / SimpleUiTest.java
Last active August 29, 2015 14:20
Simple UI test class to demonstrate screenshot automation
public class SimpleUiTest extends InstrumentationTestCase {
private UiDevice mDevice;
private String PACKAGE_NAME = "co.example.uitest";
public void setUp() {
// Initialize UiDevice instance
mDevice = UiDevice.getInstance(getInstrumentation());
// Let's start from Home
mDevice.pressHome();
dependencies {
// ...
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
androidTestCompile 'com.android.support:support-v4:22.1.1'
}
@swanhtet1992
swanhtet1992 / build.gradle
Last active August 29, 2015 14:20
build.gradle
android {
// ...
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
// ...
}
android {
// ...
productFlavors {
screenshot {
applicationId "co.example.uitest.test"
minSdkVersion 18
}
}
@swanhtet1992
swanhtet1992 / Converter.scala
Created May 13, 2015 03:29
Zawgyi <-> Unicode Converter written in Scala
// Zawgyi<>Unicode converter python module
// Based on rules from Parabaik Myanmar Text Converter Copyright (C) 2014 Ngwe Tun (Solveware Solution)
// Copyright (C) 2014 Swan Htet Aung
/**
*
* @author SH (github.com/swanhtet1992)
*/
class ParseParms(val help: String) {
@swanhtet1992
swanhtet1992 / ZgDetector.java
Created May 13, 2015 03:37
Zawgyi detector
package android.widget;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.text.TextUtils;
/**
*
* @author SH
*/
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software