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
// 实现一 | |
# 状态类 | |
sealed class Resource<T>( | |
val data: T? = null, | |
val errorCode: Int? = null | |
) { | |
class Success<T>(data: T) : Resource<T>(data) | |
class Loading<T>(data: T? = null) : Resource<T>(data) | |
class DataError<T>(errorCode: Int?) : Resource<T>(null, errorCode) |
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
var c = Calendar.getInstance() | |
c.timeInMillis = System.currentTimeMillis() | |
val hour = c.get(Calendar.HOUR_OF_DAY) | |
val minute = c.get(Calendar.MINUTE) | |
TimePickerDialog(context, TimePickerDialog.OnTimeSetListener { _, _, _ -> | |
}, hour, minute, true).show() |
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
public static String converTime(long timestamp) { | |
long currentSeconds = getFixedCurrentTime() / 1000; | |
long timeGap = currentSeconds - timestamp / 1000;// 与现在时间相差秒数 | |
String timeStr = null; | |
if (timeGap > 24 * 60 * 60 * 365) {// 1天以上 | |
// timeStr = timeGap / (24 * 60 * 60) + "天前"; | |
timeStr = new SimpleDateFormat("yyyy年MM月dd日").format(new Date(timestamp)); | |
} else if (timeGap > 24 * 60 * 60) { | |
timeStr = new SimpleDateFormat("MM月dd日").format(new Date(timestamp)); | |
if (timeStr.startsWith("0")) { |
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
Intent emailIntent = new Intent(Intent.ACTION_SEND); | |
emailIntent.setType("message/rfc822"); | |
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); | |
emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject); | |
emailIntent.putExtra(Intent.EXTRA_TEXT, emailContent); | |
if (emailIntent.resolveActivity(context.getPackageManager()) != null) { | |
context.startActivity(Intent.createChooser(emailIntent, "Send email ...")); | |
} else { | |
if (emailClientNotInstalledCallback != null) { | |
emailClientNotInstalledCallback.handle(); |
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
adb push /Users/dean/Documents/flirten2/flirten2-android/flirten/app/app-integration-release.apk /sdcard/Download |
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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.test_activity_custom_ui_3); | |
addFragment(android.R.id.content, | |
DiamondsWalletFragment.newInstance(), | |
"DiamondsWalletFragment"); | |
} | |
protected void addFragment(int containerViewId, |
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
<com.rey.material.widget.Spinner | |
android:id="@+id/speciality" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:layout_below="@+id/job_layout" | |
android:layout_marginLeft="@dimen/profile_detail_common_margin" | |
android:layout_marginRight="@dimen/profile_detail_common_margin" | |
android:layout_marginTop="20dp" | |
android:minWidth="128dp" | |
app:spn_arrowSize="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
nextBtn.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
if (event.getAction() == MotionEvent.ACTION_DOWN) { | |
nextBtn.setBackgroundResource(R.drawable.gender_next_btn_selected); | |
} else if (event.getAction() == MotionEvent.ACTION_UP) { | |
callback.nextBtnClick(); | |
} | |
return false; | |
} |
NewerOlder