From 0cf49a6cd3ee237d41f23e7f34e65b1fedde1e3e Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Mon, 6 Apr 2015 00:01:39 +0200 Subject: [PATCH] AddServerActivity: Add "Done / Discard" buttons to toolbar. --- .../org/yaaic/activity/AddServerActivity.java | 61 ++++-------------- .../res/drawable-hdpi/ic_action_discard.png | Bin 0 -> 395 bytes .../main/res/drawable-hdpi/ic_action_done.png | Bin 0 -> 392 bytes .../res/drawable-mdpi/ic_action_discard.png | Bin 0 -> 299 bytes .../main/res/drawable-mdpi/ic_action_done.png | Bin 0 -> 276 bytes .../res/drawable-xhdpi/ic_action_discard.png | Bin 0 -> 555 bytes .../res/drawable-xhdpi/ic_action_done.png | Bin 0 -> 518 bytes .../res/drawable-xxhdpi/ic_action_discard.png | Bin 0 -> 798 bytes .../res/drawable-xxhdpi/ic_action_done.png | Bin 0 -> 665 bytes .../main/res/layout/activity_add_server.xml | 23 +------ app/src/main/res/layout/item_done_discard.xml | 56 ++++++++++++++++ app/src/main/res/menu/addserver.xml | 28 -------- app/src/main/res/values/strings.xml | 2 +- 13 files changed, 72 insertions(+), 98 deletions(-) create mode 100755 app/src/main/res/drawable-hdpi/ic_action_discard.png create mode 100755 app/src/main/res/drawable-hdpi/ic_action_done.png create mode 100755 app/src/main/res/drawable-mdpi/ic_action_discard.png create mode 100755 app/src/main/res/drawable-mdpi/ic_action_done.png create mode 100755 app/src/main/res/drawable-xhdpi/ic_action_discard.png create mode 100755 app/src/main/res/drawable-xhdpi/ic_action_done.png create mode 100755 app/src/main/res/drawable-xxhdpi/ic_action_discard.png create mode 100755 app/src/main/res/drawable-xxhdpi/ic_action_done.png create mode 100644 app/src/main/res/layout/item_done_discard.xml delete mode 100644 app/src/main/res/menu/addserver.xml diff --git a/app/src/main/java/org/yaaic/activity/AddServerActivity.java b/app/src/main/java/org/yaaic/activity/AddServerActivity.java index 7a82092..c4cb189 100644 --- a/app/src/main/java/org/yaaic/activity/AddServerActivity.java +++ b/app/src/main/java/org/yaaic/activity/AddServerActivity.java @@ -26,6 +26,7 @@ import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.Toolbar; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; @@ -81,22 +82,19 @@ public class AddServerActivity extends ActionBarActivity implements OnClickListe setContentView(R.layout.activity_add_server); 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(); - actionBar.setDisplayHomeAsUpEnabled(true); + setSupportActionBar(toolbar); authentication = new Authentication(); aliases = new ArrayList(); channels = new ArrayList(); commands = new ArrayList(); - ((Button) findViewById(R.id.add)).setOnClickListener(this); - ((Button) findViewById(R.id.cancel)).setOnClickListener(this); - ((Button) findViewById(R.id.aliases)).setOnClickListener(this); - ((Button) findViewById(R.id.channels)).setOnClickListener(this); - ((Button) findViewById(R.id.commands)).setOnClickListener(this); - ((Button) findViewById(R.id.authentication)).setOnClickListener(this); + findViewById(R.id.aliases).setOnClickListener(this); + findViewById(R.id.channels).setOnClickListener(this); + findViewById(R.id.commands).setOnClickListener(this); + findViewById(R.id.authentication).setOnClickListener(this); Spinner spinner = (Spinner) findViewById(R.id.charset); 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 */ @@ -255,22 +224,18 @@ public class AddServerActivity extends ActionBarActivity implements OnClickListe commandsIntent.putExtra(Extra.COMMANDS, commands); startActivityForResult(commandsIntent, REQUEST_CODE_COMMANDS); break; - - case R.id.add: - save(); - break; - - case R.id.cancel: - setResult(RESULT_CANCELED); - finish(); - break; } } + public void onCancel(View view) { + setResult(RESULT_CANCELED); + finish(); + } + /** * Try to save server. */ - private void save() { + public void onSave(View view) { try { validateServer(); validateIdentity(); diff --git a/app/src/main/res/drawable-hdpi/ic_action_discard.png b/app/src/main/res/drawable-hdpi/ic_action_discard.png new file mode 100755 index 0000000000000000000000000000000000000000..6fa930c16ba188386ee90802c70f9238894d401a GIT binary patch literal 395 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(Fa~+LIEG|6zny+C*V&NAdF9ku znU|_}J6O4Ga;VNA0LUGa2c7`)f zDINUG6)Y1~?L;1k9l5_Sdu`G0W&FQ=+!vic@KuR<`)|dCj}8mpm~yXyLp+{gvF)xe zVp65EQ~5sb4g2~2_KThaGYyS%jlbx9dBJXWG3n(wm%r>b>#CmJ@jk|TfFto)Th797 zJS-oM#_+QVIW-Bo7$K44$rjF6*2UngH6Vra=Gz literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-hdpi/ic_action_done.png b/app/src/main/res/drawable-hdpi/ic_action_done.png new file mode 100755 index 0000000000000000000000000000000000000000..8dc08bc3fe3fb7df794b78222065edd5cea8b0f3 GIT binary patch literal 392 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(F#3DCIEG|6znykA^RReX%p1-FjZgf~%=*8mk>NjU z0{;V_Pg_D3?K;4)@3GyaJvtLtXc;i=?_~=*u$?zFQ$e&wv~kLZqpU%P#YImr#``FU z|IuPJuIAOB)ApqHUF2M0yC{VN^~@D)AGjYRdnuX!k!mz&c)$0GyQmdKI;Vst02W4>m;e9( literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_discard.png b/app/src/main/res/drawable-mdpi/ic_action_discard.png new file mode 100755 index 0000000000000000000000000000000000000000..b546ba6bc022e44f0ca737084c865b71d0fc1e02 GIT binary patch literal 299 zcmV+`0o4A9P)mYA52G+7%tHNTsXHDjc5}Bv8cr&+Jrz(&TCC%-GSLCj^6f# xiKe5t@6RaJ$1UqwE!ZNE+B*yk0)s$z0$*bWgdto*rJ?`;002ovPDHLkV1jk_b^ZVV literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/ic_action_done.png b/app/src/main/res/drawable-mdpi/ic_action_done.png new file mode 100755 index 0000000000000000000000000000000000000000..3bea20edf803ecf1057ffc23e32bb93b258c73ee GIT binary patch literal 276 zcmV+v0qg#WP)K&H!fnE&#U3>6wb z(l{Rna071OzYVDBMns-dvt}^^s=5WvKqn&CZxD+B48m8y?WX`a;lWB(1G(W<0p^5P z1DG401W?s*h)%#=L>^-&xg^{Iumdi@3pmCQrQu0{P@t-N;1EO92sZ(YL439%44LFT zPyKP3uVG{&^eqlI8|YUtfC#T9CtPaf{dcp02x2`oUajHT267r(YqJel8(Zrfzzw*8 a<_6x)iC7__Frf?p0000JC zemNGj@ntk}Jvi2QJCAjX1A776MSc^53>EiHi;kqc*(iK-^5*NWEAMYsw{JP9FSV!6 zg26nYfN38qoA?2K$NM0L`h)0%0>(YuKg2%h8dxyiXPU-j@R_xNo#DRAmsFeYrVZK* z>s`KNn{J=UxbTNKgE>PT!<>#6hm#hbso{RWc|f(npW%F%fDWS#(~f>FF^)|al!RwQ zP7>b`^rvL6;KiFv>r@+-wu;R(@UB~Ro#lxJczbqI{w~%>T;V-(MQbGfR|1)yk8+7cRUi mTqAuUdDX00cW_DkV_5QEA)qSJYCkX$FnGH9xvXLo{r>OG zuX_T1x@+CHXH*ahux!j|JjE=~p0LGXi^EfvMXXx<4tJO?0^wBQ4zU$B44?P1hI|#- zAu#c|NayC9#a~@FzrnF@3qVaxIW7^ zEMt{(eUhCmJmGK+`{}=u6HfopVR&NlUd|!!^E$>U2JgijG(YPxPBD4U=aBh1jUnVK z#}3wcE>CjLoIWA)%$H%sE5;8Da~S0hoLwfc%xFH3L+JO};QI^;wLe ztnswjzrRoR^Lrk;@@z6=34g%V)yJ$hn456Qorz|;p}`qNvpnZhCQaT|_?hKP)Wh{EI@jlzoGj#iFyDCLPpizf z^sOIrI3*^qh(FuR95JzF?v#&PxBi^Ou*>+NN@|sLG{a7=?N#f3nr4JXtbESW5VU0P lI$_QaS<6CVClbfm|9R;t$M`p4vcULd@O1TaS?83{1OWBm;lTg^ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/ic_action_discard.png b/app/src/main/res/drawable-xxhdpi/ic_action_discard.png new file mode 100755 index 0000000000000000000000000000000000000000..7925f93b7e570750af32378a423d03f892dca70d GIT binary patch literal 798 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>V0!B5;uum9_jYz--XQ~?*2&tr z&u^?VDO+0D_ttBslBtlBuJ6ay^Lyp$50?F|EoI_d>8h{Q=(Tp;BUh#q{EaLg3^N&a z?y+)UI>B<{=~YG{2Q>%1^?VZ;j2Me5OB+}wa85YAnpvg6ry(XzR)H~v>B*;844ewW z3e&^c@o9}>-*U~)OEZ7#wS2YaYq!ERpRT`Fl^VnDdVuNwraK?_y$><{FW%Y5?cB7x z!TQJJg~ihg*z053ce8{uN`JVknsZ>e#|NnYxr@8qr!4JI z7Ps73_C+H$R)@gP)&} z+4lYBhsht#+88j`*Vy#7h%l+`d%oT_LsO+i{DaCLleq#>2Uz}mOxJql_Wz#6{}+EZ zFr_`{uh;kaz#-B9tG|G!UdN(-_K)zbnV*H=?`B_FLaxs zbzoEHN3V_ViVtWXbiUKgqM#vFYeHt4&5Ip`o2)Dg%qF zGaskH0p}JkhNeY|?JN=x6rEHV94}6AX5#rEuu!OBLBU`p_GaSW-5dprB0?_mQG*ZKbw zc_kVwBbr$w7_KGo%ve_aAwNZP;v%hHr&-UF?eBYqE?ssu_uR+OBun3A>|P2BUvimq zHn2Cccrf@d^o294FsLycU(G1QAl&fyDg$Q&=Yfw|4J-#(9#oh*FeNY*?2%GnG+?xd zU$@Hc|FD{4#)Ii!uO8oYEGsQP-TQ^;zTFMlKR!ntTPal4_Fn4&+n-?7 zFMRi-53HVQ3uXN7 z(ZRKUSA(*U(qVU&KkkQ2GBq~8_~~}DQf^~S>CWU_-4l;(-yB;rclwH_GY%g*E@jZa zL{?}UTkLh^dOL$PjOAV&jPm&h961vom@6kd@7!6VBl2e%%bN)Te09Z4W-2W$_m?z? zawa}B*G^D;c=U0;qnz-n#lMf}JNN(lpmBdP!;K|0h(ZRP2mEJl^B3IPmwOGE. + android:scrollbarStyle="outsideInset" + android:padding="8dp"> . android:layout_height="wrap_content" android:prompt="@string/select_charset" /> - - -