Exit button in status bar
This commit is contained in:
parent
cc656726e1
commit
606b19b15c
4 changed files with 27 additions and 11 deletions
|
@ -20,11 +20,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@android:color/black">
|
android:background="@android:color/black">
|
||||||
|
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/menu_exit" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
@ -71,6 +66,14 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_alignParentRight="true" />
|
android:layout_alignParentRight="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/exit"
|
||||||
|
android:text="EXIT"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:paddingRight="10dp" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</org.linphone.ui.SlidingDrawer>
|
</org.linphone.ui.SlidingDrawer>
|
||||||
|
|
|
@ -593,12 +593,16 @@ public class LinphoneActivity extends FragmentActivity implements OnClickListene
|
||||||
return chatStorage;
|
return chatStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exit() {
|
||||||
|
finish();
|
||||||
|
stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
|
if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
|
||||||
if (data.getExtras().getBoolean("Exit", false)) {
|
if (data.getExtras().getBoolean("Exit", false)) {
|
||||||
finish();
|
exit();
|
||||||
stopService(new Intent(ACTION_MAIN).setClass(this, LinphoneService.class));
|
|
||||||
} else {
|
} else {
|
||||||
FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay");
|
FragmentsAvailable newFragment = (FragmentsAvailable) data.getExtras().getSerializable("FragmentToDisplay");
|
||||||
changeCurrentFragment(newFragment, null, true);
|
changeCurrentFragment(newFragment, null, true);
|
||||||
|
|
|
@ -28,6 +28,7 @@ import android.os.Handler;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -57,6 +58,12 @@ public class StatusFragment extends Fragment {
|
||||||
encryption = (ImageView) view.findViewById(R.id.encryption);
|
encryption = (ImageView) view.findViewById(R.id.encryption);
|
||||||
|
|
||||||
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
drawer = (SlidingDrawer) view.findViewById(R.id.statusBar);
|
||||||
|
view.findViewById(R.id.exit).setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
LinphoneActivity.instance().exit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -194,7 +201,9 @@ public class StatusFragment extends Fragment {
|
||||||
drawer.lock();
|
drawer.lock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (drawer != null && !getResources().getBoolean(R.bool.lock_statusbar)) {
|
if (drawer != null && getResources().getBoolean(R.bool.lock_statusbar)) {
|
||||||
|
drawer.lock();
|
||||||
|
} else if (drawer != null) {
|
||||||
drawer.unlock();
|
drawer.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -417,13 +417,13 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
mVelocityTracker.addMovement(event);
|
mVelocityTracker.addMovement(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return onTouchEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
if (mLocked) {
|
if (mLocked) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTracking) {
|
if (mTracking) {
|
||||||
|
@ -534,7 +534,7 @@ public class SlidingDrawer extends ViewGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mTracking || mAnimating || super.onTouchEvent(event);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateClose(int position) {
|
private void animateClose(int position) {
|
||||||
|
|
Loading…
Reference in a new issue