Skip to content

Instantly share code, notes, and snippets.

View est7's full-sized avatar
🕶️
dying

est7 est7

🕶️
dying
View GitHub Profile
我们现在来扮演一个问答工具,你叫做 ChatTool。
在运行中,返回 ChatTool 的输出。不需要其他内容。
你的目标是和用户一起玩猜谜语的游戏,并且判断用户是否猜对。
猜谜语的过程如下:
1. 根据所指定的谜语,分析谜题里的题目、目标和谜底。然后告诉用户谜题;
2. 用户回复答案。
3. 仔细检查用户的回复。如果用户回复了和答案无关的内容,甚至没有试图猜答案,你会礼貌但风趣地提醒用户提供答案,完成游戏。
4. 如果用户累计 2 次回答和答案无关的内容,那么你会回到步骤1,发送一个新的谜语。
@aqua30
aqua30 / AdjustingViewPager.kt
Created May 1, 2021 09:29
Adjusting View Pager which adjusts its height according to the view's height in focus
package com.aqua30.learningproject
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.View
import android.view.View.MeasureSpec
import androidx.viewpager.widget.ViewPager
class AdjustingViewPager: ViewPager {
/**
* A mediator to link a fragment container with a BottomNavigationView.
*
* The mediator will synchronize the fragment container's content
* with the selected item when a item of BottomNavigationView is selected.
*/
class FragmentBottomNavigationMediator(
private val fragmentManager: FragmentManager,
@IdRes private val containerViewId: Int,
private val bottomNavigationView: BottomNavigationView,
@FabrizioAlmeidaFerreira
FabrizioAlmeidaFerreira / Connectivity.kt
Last active November 21, 2022 02:03
Kotlin Android check connectivity
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.telephony.TelephonyManager
import android.util.Log
class Connectivity {
// get network info
@maoruibin
maoruibin / EditTextCountWatch.java
Last active March 30, 2023 09:51
EditText View 限制输入字符数,并倒计还能输入多少字符,兼容中英文字符
/**
* EditText View 限制输入字符数,并倒计还能输入多少字符,兼容中英文字符
* author : ruibin1 (ruibin1@staff.weibo.com)
* create : 2019/3/28 - 2:12 PM.
* thanks : https://github.com/FJ917/FJEditTextCount
*/
public class EditTextCountWatch {
private EditText mEtContent;
private TextView mTvNum;
//最大字符
```java
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.provider.MediaStore;
import android.text.TextUtils;
@maoruibin
maoruibin / ListenClipboardService.java
Created February 25, 2016 13:45
生成一个处于前台状态的通知
private void showNormalNotification(Context context) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setContentTitle("Title");
builder.setContentText("Description");
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setPriority(NotificationCompat.PRIORITY_MIN);
builder.setOngoing(true);
long[] vibrate = {0, 50, 0, 0};
builder.setVibrate(vibrate);
@gabrielemariotti
gabrielemariotti / Readme.md
Last active August 5, 2025 08:11
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

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: