Skip to content

Commit

Permalink
hzuapps#3 提交实验3代码
Browse files Browse the repository at this point in the history
  • Loading branch information
yinghaocai committed Apr 12, 2019
1 parent be263eb commit d7ba9a1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ public static void finishAll(){
}
}
activities.clear();
android.os.Process.killProcess(android.os.Process.myPid());//kill all processes
//android.os.Process.killProcess(android.os.Process.myPid());//kill all processes,exit without heritage
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public void onClick(View v) {
select_yes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Com1714080901141MainActivity.exit=true;
Com1714080901141ActivityCollector.finishAll();//exit all activity

}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class Com1714080901141MainActivity extends Com1714080901141BaseActivity {

private TextView mTextMessage;
public static boolean exit;

private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
Expand All @@ -37,23 +38,18 @@ public boolean onNavigationItemSelected(@NonNull MenuItem item) {
}
};

@Override
public void onBackPressed() {
Intent intent=new Intent(Com1714080901141MainActivity.this,Com1714080901141DialogActivity.class);
startActivity(intent);
}


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
exit=false;
setContentView(R.layout.activity_main);

mTextMessage = (TextView) findViewById(R.id.message);
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

Button startDialogActivity=(Button) findViewById(R.id.start_dialog_activity);
startDialogActivity.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v){
Intent intent=new Intent(Com1714080901141MainActivity.this,Com1714080901141DialogActivity.class);
startActivity(intent);
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,4 @@
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />

<Button
android:id="@+id/start_dialog_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="exit"
tools:layout_editor_absoluteX="323dp"
tools:layout_editor_absoluteY="627dp" />
</android.support.constraint.ConstraintLayout>

0 comments on commit d7ba9a1

Please sign in to comment.