From 90055e839c123c984a35171e81c5ab77f8f56b00 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Fri, 13 Mar 2015 23:42:47 +0100 Subject: [PATCH] Remove ActionBarSherlock dependency and refactor code to use native ActionBar. --- app/build.gradle | 1 - .../org/yaaic/activity/AddServerActivity.java | 43 +++++++++---------- .../yaaic/activity/ConversationActivity.java | 15 +++---- .../org/yaaic/activity/ServersActivity.java | 11 +++-- .../org/yaaic/activity/SettingsActivity.java | 11 +++-- 5 files changed, 38 insertions(+), 43 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1404fee..3575aef 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' compile 'com.android.support:support-v4:22.0.0' compile 'com.viewpagerindicator:library:2.4.1@aar' diff --git a/app/src/main/java/org/yaaic/activity/AddServerActivity.java b/app/src/main/java/org/yaaic/activity/AddServerActivity.java index fa0d2e8..c89462e 100644 --- a/app/src/main/java/org/yaaic/activity/AddServerActivity.java +++ b/app/src/main/java/org/yaaic/activity/AddServerActivity.java @@ -20,9 +20,22 @@ along with Yaaic. If not, see . */ package org.yaaic.activity; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.regex.Pattern; +import android.app.ActionBar; +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.view.View.OnClickListener; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.Spinner; +import android.widget.Toast; import org.yaaic.R; import org.yaaic.Yaaic; @@ -34,30 +47,16 @@ import org.yaaic.model.Identity; import org.yaaic.model.Server; import org.yaaic.model.Status; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.CheckBox; -import android.widget.EditText; -import android.widget.Spinner; -import android.widget.Toast; - -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.regex.Pattern; /** * Add a new server to the list * * @author Sebastian Kaspari */ -public class AddServerActivity extends SherlockActivity implements OnClickListener +public class AddServerActivity extends Activity implements OnClickListener { private static final int REQUEST_CODE_CHANNELS = 1; private static final int REQUEST_CODE_COMMANDS = 2; @@ -80,7 +79,7 @@ public class AddServerActivity extends SherlockActivity implements OnClickListen setContentView(R.layout.serveradd); - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); authentication = new Authentication(); diff --git a/app/src/main/java/org/yaaic/activity/ConversationActivity.java b/app/src/main/java/org/yaaic/activity/ConversationActivity.java index f7b1aa1..a46e8fd 100644 --- a/app/src/main/java/org/yaaic/activity/ConversationActivity.java +++ b/app/src/main/java/org/yaaic/activity/ConversationActivity.java @@ -51,6 +51,8 @@ import org.yaaic.model.User; import org.yaaic.receiver.ConversationReceiver; import org.yaaic.receiver.ServerReceiver; +import android.app.ActionBar; +import android.app.Activity; import android.app.AlertDialog; import android.content.ComponentName; import android.content.DialogInterface; @@ -69,6 +71,9 @@ import android.support.v4.view.ViewPager; import android.text.InputType; import android.text.method.TextKeyListener; import android.view.KeyEvent; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.view.View.OnKeyListener; import android.view.inputmethod.EditorInfo; @@ -77,18 +82,12 @@ import android.widget.Button; import android.widget.EditText; import android.widget.Toast; -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - /** * The server view with a scrollable list of all channels * * @author Sebastian Kaspari */ -public class ConversationActivity extends SherlockActivity implements ServiceConnection, ServerListener, ConversationListener +public class ConversationActivity extends Activity implements ServiceConnection, ServerListener, ConversationListener { public static final int REQUEST_CODE_SPEECH = 99; @@ -189,7 +188,7 @@ public class ConversationActivity extends SherlockActivity implements ServiceCon this.finish(); } - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); setTitle(server.getTitle()); diff --git a/app/src/main/java/org/yaaic/activity/ServersActivity.java b/app/src/main/java/org/yaaic/activity/ServersActivity.java index 79f873a..434d9b7 100644 --- a/app/src/main/java/org/yaaic/activity/ServersActivity.java +++ b/app/src/main/java/org/yaaic/activity/ServersActivity.java @@ -35,6 +35,7 @@ import org.yaaic.model.Server; import org.yaaic.model.Status; import org.yaaic.receiver.ServerReceiver; +import android.app.Activity; import android.app.AlertDialog; import android.content.ComponentName; import android.content.DialogInterface; @@ -43,6 +44,9 @@ import android.content.IntentFilter; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -50,17 +54,12 @@ import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListView; import android.widget.Toast; -import com.actionbarsherlock.app.SherlockActivity; -import com.actionbarsherlock.view.Menu; -import com.actionbarsherlock.view.MenuInflater; -import com.actionbarsherlock.view.MenuItem; - /** * List of servers * * @author Sebastian Kaspari */ -public class ServersActivity extends SherlockActivity implements ServiceConnection, ServerListener, OnItemClickListener, OnItemLongClickListener { +public class ServersActivity extends Activity implements ServiceConnection, ServerListener, OnItemClickListener, OnItemLongClickListener { private IRCBinder binder; private ServerReceiver receiver; private ServerListAdapter adapter; diff --git a/app/src/main/java/org/yaaic/activity/SettingsActivity.java b/app/src/main/java/org/yaaic/activity/SettingsActivity.java index c46afc9..3bc8433 100644 --- a/app/src/main/java/org/yaaic/activity/SettingsActivity.java +++ b/app/src/main/java/org/yaaic/activity/SettingsActivity.java @@ -22,18 +22,17 @@ package org.yaaic.activity; import org.yaaic.R; +import android.app.ActionBar; import android.os.Bundle; - -import com.actionbarsherlock.app.ActionBar; -import com.actionbarsherlock.app.SherlockPreferenceActivity; -import com.actionbarsherlock.view.MenuItem; +import android.preference.PreferenceActivity; +import android.view.MenuItem; /** * Settings * * @author Sebastian Kaspari */ -public class SettingsActivity extends SherlockPreferenceActivity +public class SettingsActivity extends PreferenceActivity { /** * On create @@ -43,7 +42,7 @@ public class SettingsActivity extends SherlockPreferenceActivity { super.onCreate(savedInstanceState); - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); addPreferencesFromResource(R.xml.preferences);