Skip to content

Instantly share code, notes, and snippets.

vuhung3990 vuhung3990

  • Ha Noi
View GitHub Profile
@vuhung3990
vuhung3990 / .editorconfig
Created Sep 20, 2018
EditorConfig for android project (2 space style)
View .editorconfig
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*.{java,kt,xml}]
end_of_line = lf
insert_final_newline = true
View privacy_policy.html
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>Privacy Policy</title> <style>body{font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; padding:1em;}</style></head> <body><h2>Privacy Policy</h2> <p> built the Chuyển đổi 11 số sang 10 số các mạng app as a Free app. This SERVICE is provided by at no cost and is intended for use as is.
</p> <p>This page is used to inform visitors regarding my policies with the collection, use, and
disclosure of Personal Information if anyone decided to use my Service.
</p> <p>If you choose to use my Service, then you agree to the collection and use of information in relation
to this policy. The Personal Information that I collect is used for providing and improving the
Service. I will not use or share your information with anyone except as described
in this Privacy Policy.
</
View Test.java
public class MainActivityTest {
@Rule
public IntentsTestRule<MainActivity> rule = new IntentsTestRule<MainActivity>(MainActivity.class);
@Test
public void openExport_shouldPass() throws Exception {
onView(withId(R.id.export_contact)).perform(click());
intended(
allOf(
@vuhung3990
vuhung3990 / ImageSliderAdapter.java
Last active May 12, 2018
simple image slider for android
View ImageSliderAdapter.java
public class ImageSliderAdapter extends FragmentPagerAdapter {
private final List<Fragment> fragmentList = new ArrayList<>();
public ImageSliderAdapter(@NonNull FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return fragmentList.get(position);
@vuhung3990
vuhung3990 / MainActivityTest.java
Last active Mar 7, 2017
- espresso pull to refresh and load more basic - RecyclerViewActions: androidTestCompile("com.android.support.test.espresso:espresso-contrib:$espressoVersion") { // Necessary to avoid version conflicts exclude group: 'com.android.support', module: 'appcompat' exclude group: 'com.android.support', module: 'support-v4' exclude group: 'com.android.…
View MainActivityTest.java
package com.dev22.dealhunter;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
@vuhung3990
vuhung3990 / DetectScrollToEnd.java
Last active Aug 14, 2017
recycleview load more helper
View DetectScrollToEnd.java
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
/**
* Created by dev22 on 3/1/17.
* helper class for detect when recyclerView scroll to bottom and load more data
*/
public abstract class DetectScrollToEnd extends RecyclerView.OnScrollListener {
private final LinearLayoutManager layoutManager;
private final int mThreshold;
@vuhung3990
vuhung3990 / SyncService.java
Created Feb 13, 2017
simple IntentService task queue - limit: can't update queue when running
View SyncService.java
public class SyncService extends IntentService {
public static final String TASK_KEY = "";
public static final int SYNC_CONTACT = 2;
public static final int SYNC_HISTORY = 1;
public static final int SYNC_GROUP = 0;
public SyncService() {
super(null);
}
View MainActivity.java
public class MainActivity extends AppCompatActivity {
private CountingIdlingResource idlingResource = new CountingIdlingResource("aaaaa");
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
View RxBus.java
/**
* for send object between fragment, activity, service...
* REMEMBER: dispose if not in use to avoid leak memory
*/
public class RxBus<T> {
private static final String PREFIX = "$^%)@";
private static RxBus instance;
private PublishSubject<BusMessage<T>> subject = PublishSubject.create();
@vuhung3990
vuhung3990 / layout.xml
Created Dec 4, 2016
custom background state on toggle radio group button
View layout.xml
<RadioGroup
android:orientation="horizontal"
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:checkedButton="@+id/bt1"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/bt1"
android:background="@drawable/toggle_bg"
You can’t perform that action at this time.