AddServerActivity: Add "Done / Discard" buttons to toolbar.
@ -26,6 +26,7 @@ import android.os.Bundle;
|
|||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -81,22 +82,19 @@ public class AddServerActivity extends ActionBarActivity implements OnClickListe
|
|||||||
setContentView(R.layout.activity_add_server);
|
setContentView(R.layout.activity_add_server);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
toolbar.addView(LayoutInflater.from(this).inflate(R.layout.item_done_discard, toolbar, false));
|
||||||
|
|
||||||
ActionBar actionBar = getSupportActionBar();
|
setSupportActionBar(toolbar);
|
||||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
||||||
|
|
||||||
authentication = new Authentication();
|
authentication = new Authentication();
|
||||||
aliases = new ArrayList<String>();
|
aliases = new ArrayList<String>();
|
||||||
channels = new ArrayList<String>();
|
channels = new ArrayList<String>();
|
||||||
commands = new ArrayList<String>();
|
commands = new ArrayList<String>();
|
||||||
|
|
||||||
((Button) findViewById(R.id.add)).setOnClickListener(this);
|
findViewById(R.id.aliases).setOnClickListener(this);
|
||||||
((Button) findViewById(R.id.cancel)).setOnClickListener(this);
|
findViewById(R.id.channels).setOnClickListener(this);
|
||||||
((Button) findViewById(R.id.aliases)).setOnClickListener(this);
|
findViewById(R.id.commands).setOnClickListener(this);
|
||||||
((Button) findViewById(R.id.channels)).setOnClickListener(this);
|
findViewById(R.id.authentication).setOnClickListener(this);
|
||||||
((Button) findViewById(R.id.commands)).setOnClickListener(this);
|
|
||||||
((Button) findViewById(R.id.authentication)).setOnClickListener(this);
|
|
||||||
|
|
||||||
Spinner spinner = (Spinner) findViewById(R.id.charset);
|
Spinner spinner = (Spinner) findViewById(R.id.charset);
|
||||||
String[] charsets = getResources().getStringArray(R.array.charsets);
|
String[] charsets = getResources().getStringArray(R.array.charsets);
|
||||||
@ -162,35 +160,6 @@ public class AddServerActivity extends ActionBarActivity implements OnClickListe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* On options menu requested
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu)
|
|
||||||
{
|
|
||||||
super.onCreateOptionsMenu(menu);
|
|
||||||
|
|
||||||
MenuInflater inflater = new MenuInflater(this);
|
|
||||||
inflater.inflate(R.menu.addserver, menu);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case R.id.save:
|
|
||||||
save();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case android.R.id.home:
|
|
||||||
finish();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On activity result
|
* On activity result
|
||||||
*/
|
*/
|
||||||
@ -255,22 +224,18 @@ public class AddServerActivity extends ActionBarActivity implements OnClickListe
|
|||||||
commandsIntent.putExtra(Extra.COMMANDS, commands);
|
commandsIntent.putExtra(Extra.COMMANDS, commands);
|
||||||
startActivityForResult(commandsIntent, REQUEST_CODE_COMMANDS);
|
startActivityForResult(commandsIntent, REQUEST_CODE_COMMANDS);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case R.id.add:
|
public void onCancel(View view) {
|
||||||
save();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case R.id.cancel:
|
|
||||||
setResult(RESULT_CANCELED);
|
setResult(RESULT_CANCELED);
|
||||||
finish();
|
finish();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to save server.
|
* Try to save server.
|
||||||
*/
|
*/
|
||||||
private void save() {
|
public void onSave(View view) {
|
||||||
try {
|
try {
|
||||||
validateServer();
|
validateServer();
|
||||||
validateIdentity();
|
validateIdentity();
|
||||||
|
BIN
app/src/main/res/drawable-hdpi/ic_action_discard.png
Executable file
After Width: | Height: | Size: 395 B |
BIN
app/src/main/res/drawable-hdpi/ic_action_done.png
Executable file
After Width: | Height: | Size: 392 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_discard.png
Executable file
After Width: | Height: | Size: 299 B |
BIN
app/src/main/res/drawable-mdpi/ic_action_done.png
Executable file
After Width: | Height: | Size: 276 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_discard.png
Executable file
After Width: | Height: | Size: 555 B |
BIN
app/src/main/res/drawable-xhdpi/ic_action_done.png
Executable file
After Width: | Height: | Size: 518 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_discard.png
Executable file
After Width: | Height: | Size: 798 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_action_done.png
Executable file
After Width: | Height: | Size: 665 B |
@ -34,7 +34,8 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scrollbarStyle="outsideInset">
|
android:scrollbarStyle="outsideInset"
|
||||||
|
android:padding="8dp">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@ -213,26 +214,6 @@ along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:prompt="@string/select_charset" />
|
android:prompt="@string/select_charset" />
|
||||||
<!-- ############################################################################ -->
|
<!-- ############################################################################ -->
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingTop="10dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/add"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/server_save" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/cancel"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:text="@string/action_cancel" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
56
app/src/main/res/layout/item_done_discard.xml
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:divider="?android:attr/dividerVertical"
|
||||||
|
android:dividerPadding="12dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:showDividers="middle" >
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/actionbar_discard"
|
||||||
|
style="?android:actionButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:onClick="onCancel">
|
||||||
|
|
||||||
|
<TextView style="?android:actionBarTabTextStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:drawableLeft="@drawable/ic_action_discard"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="@color/abc_primary_text_material_dark"
|
||||||
|
android:text="@string/action_cancel" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/actionbar_done"
|
||||||
|
style="?android:actionButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:onClick="onSave">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="?android:actionBarTabTextStyle"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:drawableLeft="@drawable/ic_action_done"
|
||||||
|
android:drawablePadding="8dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:textColor="@color/abc_primary_text_material_dark"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:text="@string/action_save" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Yaaic - Yet Another Android IRC Client
|
|
||||||
|
|
||||||
Copyright 2009-2013 Sebastian Kaspari
|
|
||||||
|
|
||||||
This file is part of Yaaic.
|
|
||||||
|
|
||||||
Yaaic is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
Yaaic is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with Yaaic. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
-->
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<item
|
|
||||||
android:id="@+id/save"
|
|
||||||
android:title="@string/server_save"
|
|
||||||
android:icon="@drawable/actionbar_save"
|
|
||||||
android:showAsAction="always" />
|
|
||||||
</menu>
|
|
@ -23,7 +23,6 @@
|
|||||||
<string name="server_useSSL">Use SSL</string>
|
<string name="server_useSSL">Use SSL</string>
|
||||||
<string name="server_autoconnect">Auto connect on startup</string>
|
<string name="server_autoconnect">Auto connect on startup</string>
|
||||||
<string name="server_channels">Channels</string>
|
<string name="server_channels">Channels</string>
|
||||||
<string name="server_save">Save</string>
|
|
||||||
<string name="select_charset">Select a charset</string>
|
<string name="select_charset">Select a charset</string>
|
||||||
<string name="nickname">Nickname</string>
|
<string name="nickname">Nickname</string>
|
||||||
<string name="aliases">Aliases</string>
|
<string name="aliases">Aliases</string>
|
||||||
@ -48,6 +47,7 @@
|
|||||||
<string name="preferences">Preferences</string>
|
<string name="preferences">Preferences</string>
|
||||||
<string name="charset">Charset</string>
|
<string name="charset">Charset</string>
|
||||||
|
|
||||||
|
<string name="action_save">Save</string>
|
||||||
<string name="action_remove">Remove</string>
|
<string name="action_remove">Remove</string>
|
||||||
<string name="action_add">Add</string>
|
<string name="action_add">Add</string>
|
||||||
<string name="action_ok">Ok</string>
|
<string name="action_ok">Ok</string>
|
||||||
|