5 changed files with 123 additions and 0 deletions
@ -0,0 +1,11 @@ |
|||||||
|
package cc.niushuai.dididone.biz; |
||||||
|
|
||||||
|
/** |
||||||
|
* 业务全局对象 |
||||||
|
*/ |
||||||
|
public class BizGlobal { |
||||||
|
private BizGlobal() { |
||||||
|
} |
||||||
|
|
||||||
|
public static int REQUEST_CODE_GENERAL = 1; |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package cc.niushuai.dididone.ui.setting.project; |
||||||
|
|
||||||
|
import android.content.Intent; |
||||||
|
import android.os.Bundle; |
||||||
|
import android.view.View; |
||||||
|
|
||||||
|
import cc.niushuai.dididone.biz.BizGlobal; |
||||||
|
import cc.niushuai.dididone.databinding.ActivityNewProjectBinding; |
||||||
|
import cc.niushuai.dididone.ui.base.BaseActivity; |
||||||
|
import cc.niushuai.dididone.util.XLog; |
||||||
|
|
||||||
|
public class NewProjectActivity extends BaseActivity { |
||||||
|
|
||||||
|
private ActivityNewProjectBinding binding; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onCreate(Bundle savedInstanceState) { |
||||||
|
super.onCreate(savedInstanceState); |
||||||
|
|
||||||
|
binding = ActivityNewProjectBinding.inflate(getLayoutInflater()); |
||||||
|
setContentView(binding.getRoot()); |
||||||
|
|
||||||
|
init(); |
||||||
|
|
||||||
|
setListeners(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
Intent intent = getIntent(); |
||||||
|
for (String key : intent.getExtras().keySet()) { |
||||||
|
XLog.d("key: {}, val: {}", key, intent.getStringExtra(key)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void setListeners() { |
||||||
|
binding.npBtnBack.setOnClickListener(new View.OnClickListener() { |
||||||
|
@Override |
||||||
|
public void onClick(View v) { |
||||||
|
backClick(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
private void backClick() { |
||||||
|
|
||||||
|
Intent data = new Intent(); |
||||||
|
data.putExtra("back1", "v1"); |
||||||
|
data.putExtra("back2", "v2"); |
||||||
|
data.putExtra("back3", "v3"); |
||||||
|
this.setResult(BizGlobal.REQUEST_CODE_GENERAL, data); |
||||||
|
|
||||||
|
finish(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto" |
||||||
|
xmlns:tools="http://schemas.android.com/tools" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
tools:context=".ui.setting.project.NewProjectActivity"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/np_btn_txt" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintStart_toStartOf="parent" |
||||||
|
app:layout_constraintTop_toTopOf="parent" |
||||||
|
android:text="hello new project" |
||||||
|
android:textSize="24dp"/> |
||||||
|
|
||||||
|
<Button |
||||||
|
android:id="@+id/np_btn_back" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="wrap_content" |
||||||
|
app:layout_constraintStart_toStartOf="@id/np_btn_txt" |
||||||
|
app:layout_constraintTop_toTopOf="@id/np_btn_txt" |
||||||
|
android:text="返回"/> |
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout> |
Loading…
Reference in new issue