This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.SystemClock; | |
import android.view.View; | |
import java.util.Map; | |
import java.util.WeakHashMap; | |
/** | |
* A Debounced OnClickListener | |
* Rejects clicks that are too close together in time. | |
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/29797134/how-to-use-and-style-the-new-alertdialog-from-appcompat-22-1-and-above | |
private void showViewTimeSettingDialog() { | |
// not work | |
//ContextThemeWrapper themedContext = new ContextThemeWrapper(getActivity(), R.style.CustomAlertDialogStyle); | |
//AlertDialog.Builder builder = new AlertDialog.Builder(themedContext); | |
// 向 AppTheme 中加入自定义的 AlertDialog theme 无效,必须在 Builder() 中指定 style. not work | |
/* | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Method #0:操作符(或者说关键字)instanceof | |
* object 是 C 的实例吗? | |
*/ | |
if (object instanceof C) | |
; | |
/** | |
* Method #1: isInstance(Object object) | |
* Tests whether the given object can be cast to the class represented by this Class. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- http://stackoverflow.com/questions/30674648/android-design-support-tablayout-overlapping-content --> | |
<android.support.design.widget.CoordinatorLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/main_content" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.design.widget.AppBarLayout | |
android:id="@+id/appbar" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and | |
* the specified value (exclusive), drawn from this random number generator's sequence. | |
* 返回一个在 [0, n-1] 之间均匀分布的伪随机数. | |
* | |
* @return [0, n-1] | |
*/ | |
int nextInt(int n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.AlertDialog; | |
// Refer to: http://stackoverflow.com/questions/1979369/android-activity-as-a-dialog | |
public class DialogThemeActivity extends Activity { | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
new AlertDialog.Builder(this) | |
.setTitle("title") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Refer to: http://stackoverflow.com/questions/20862258/android-how-to-get-appcompat-translucent-type-theme-with-support-actionbar--> | |
<!-- /res/values/styles.xml --> | |
<style name="Theme.AppCompat.Translucent"> | |
<item name="android:windowNoTitle">true</item> | |
<item name="android:windowBackground">@android:color/transparent</item> | |
<item name="android:colorBackgroundCacheHint">@null</item> | |
<item name="android:windowIsTranslucent">true</item> | |
<item name="android:windowAnimationStyle">@android:style/Animation</item> | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android.support.v7.widget.Toolbar | |
xmlns:app="schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@color/primaryColor" | |
android:contentInsetLeft="0dp" | |
android:contentInsetStart="0dp" | |
app:contentInsetLeft="0dp" | |
app:contentInsetStart="0dp" | |
android:contentInsetRight="0dp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Built application files | |
/*/build/ | |
# Crashlytics configuations | |
com_crashlytics_export_strings.xml | |
# Local configuration file (sdk path, etc) | |
local.properties | |
# Gradle generated files |