diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-10-01 22:57:53 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-10-01 22:57:57 +0900 |
commit | b6904c24c430b004f816f8390b8a730ea0058630 (patch) | |
tree | c0fa1cbcee97d473e0c46cecfb14cf5e59f5c7ac /app/src/main/java/net/lacolaco/smileessence | |
parent | 659646390ee980ac615f36585ddddee28c0526e4 (diff) | |
download | SmileEssence-b6904c24c430b004f816f8390b8a730ea0058630.tar.gz |
ActionBar に Spinner いれようと思ってたけどやめたので AppCompat / Toolbar を使う必要がなくなった
Diffstat (limited to 'app/src/main/java/net/lacolaco/smileessence')
10 files changed, 27 insertions, 76 deletions
diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/EditCommandActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/EditCommandActivity.java index 32cb49ea..901e372d 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/EditCommandActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/EditCommandActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.widget.ListView; @@ -44,7 +43,7 @@ import net.lacolaco.smileessence.viewmodel.CheckBoxModel; import java.util.ArrayList; import java.util.List; -public class EditCommandActivity extends AppCompatActivity { +public class EditCommandActivity extends Activity { // ------------------------------ FIELDS ------------------------------ @@ -88,10 +87,6 @@ public class EditCommandActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.layout_edit_list); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - initializeViews(); Logger.debug("onCreate"); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/EditExtractionActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/EditExtractionActivity.java index 584c4c7c..8d8a36da 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/EditExtractionActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/EditExtractionActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.SparseBooleanArray; import android.view.*; @@ -44,7 +43,7 @@ import net.lacolaco.smileessence.view.dialog.EditTextDialogFragment; import java.util.List; -public class EditExtractionActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, +public class EditExtractionActivity extends Activity implements AdapterView.OnItemClickListener, AbsListView.MultiChoiceModeListener { // ------------------------------ FIELDS ------------------------------ @@ -116,10 +115,6 @@ public class EditExtractionActivity extends AppCompatActivity implements Adapter super.onCreate(savedInstanceState); setContentView(R.layout.layout_edit_list); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - initializeViews(); Logger.debug("onCreate"); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/EditTabActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/EditTabActivity.java index 7195b0cf..58ee1d8a 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/EditTabActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/EditTabActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.ListView; import net.lacolaco.smileessence.Application; @@ -41,7 +40,7 @@ import net.lacolaco.smileessence.viewmodel.EditableCheckBoxModel; import java.util.ArrayList; import java.util.List; -public class EditTabActivity extends AppCompatActivity { +public class EditTabActivity extends Activity { // ------------------------------ FIELDS ------------------------------ @@ -92,10 +91,6 @@ public class EditTabActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.layout_edit_list); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - initializeViews(); Logger.debug("onCreate"); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java index 15d63929..44dfff4d 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/EditTemplateActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.util.SparseBooleanArray; import android.view.*; @@ -44,7 +43,7 @@ import net.lacolaco.smileessence.view.dialog.EditTextDialogFragment; import java.util.List; -public class EditTemplateActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, +public class EditTemplateActivity extends Activity implements AdapterView.OnItemClickListener, AbsListView.MultiChoiceModeListener { // ------------------------------ FIELDS ------------------------------ @@ -116,10 +115,6 @@ public class EditTemplateActivity extends AppCompatActivity implements AdapterVi super.onCreate(savedInstanceState); setContentView(R.layout.layout_edit_list); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - initializeViews(); Logger.debug("onCreate"); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/LicenseActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/LicenseActivity.java index d14ef80c..53946bd4 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/LicenseActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/LicenseActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.LinearLayout; import android.widget.TextView; @@ -37,7 +36,7 @@ import net.lacolaco.smileessence.R; import java.util.ArrayList; import java.util.List; -public class LicenseActivity extends AppCompatActivity { +public class LicenseActivity extends Activity { // --------------------- GETTER / SETTER METHODS --------------------- @@ -65,10 +64,6 @@ public class LicenseActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.layout_license); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - setFiles(); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java index ce849742..d1e45509 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/MainActivity.java @@ -24,26 +24,23 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.WindowManager; -import android.widget.TextView; -import com.android.volley.toolbox.NetworkImageView; +import android.widget.ImageView; import net.lacolaco.smileessence.Application; import net.lacolaco.smileessence.BuildConfig; import net.lacolaco.smileessence.IntentRouter; import net.lacolaco.smileessence.R; import net.lacolaco.smileessence.command.CommandOpenURL; -import net.lacolaco.smileessence.data.ImageCache; import net.lacolaco.smileessence.data.PostState; import net.lacolaco.smileessence.entity.*; import net.lacolaco.smileessence.logging.Logger; @@ -54,6 +51,7 @@ import net.lacolaco.smileessence.preference.UserPreferenceHelper; import net.lacolaco.smileessence.twitter.UserStreamListener; import net.lacolaco.smileessence.twitter.task.ShowUserTask; import net.lacolaco.smileessence.util.BitmapOptimizer; +import net.lacolaco.smileessence.util.BitmapURLTask; import net.lacolaco.smileessence.util.NetworkHelper; import net.lacolaco.smileessence.util.UIHandler; import net.lacolaco.smileessence.view.*; @@ -61,7 +59,7 @@ import net.lacolaco.smileessence.view.adapter.PageListAdapter; import net.lacolaco.smileessence.view.dialog.ConfirmDialogFragment; import twitter4j.TwitterStream; -public class MainActivity extends AppCompatActivity { +public class MainActivity extends Activity { // ------------------------------ FIELDS ------------------------------ @@ -357,18 +355,13 @@ public class MainActivity extends AppCompatActivity { startStream(); MuteUserIds.refresh(account); account.refreshListSubscriptions(); - - getSupportActionBar().setDisplayShowTitleEnabled(false); - final TextView toolbarTitle = (TextView) findViewById(R.id.toolbar_text); - final NetworkImageView iconImageView = (NetworkImageView) findViewById(R.id.toolbar_icon); + + final ImageView iconImageView = (ImageView) findViewById(android.R.id.home); Runnable update = () -> { - toolbarTitle.setText(account.getUser().getScreenName()); - String oldUrl = iconImageView.getImageURL(); + getActionBar().setTitle(user.getScreenName()); String newUrl = user.getProfileImageUrl(); - if (newUrl != null && (oldUrl == null || !oldUrl.equals(newUrl))) { - ImageCache.getInstance().setImageToView(newUrl, iconImageView); - } + new BitmapURLTask(newUrl, iconImageView).execute(); }; update.run(); @@ -414,11 +407,10 @@ public class MainActivity extends AppCompatActivity { } public void initializeView() { - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - viewPager = (ViewPager) findViewById(R.id.viewPager); pagerAdapter = new PageListAdapter(this, viewPager); + ImageView iconImageView = (ImageView) findViewById(android.R.id.home); + iconImageView.setScaleType(ImageView.ScaleType.FIT_CENTER); initializePages(); } diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/ManageAccountsActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/ManageAccountsActivity.java index 508c3b83..792aef87 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/ManageAccountsActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/ManageAccountsActivity.java @@ -24,11 +24,10 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.*; import android.widget.*; import net.lacolaco.smileessence.Application; @@ -43,7 +42,7 @@ import net.lacolaco.smileessence.view.dialog.ConfirmDialogFragment; import java.util.ArrayList; import java.util.List; -public class ManageAccountsActivity extends AppCompatActivity implements AdapterView.OnItemClickListener, AbsListView.OnItemLongClickListener { +public class ManageAccountsActivity extends Activity implements AdapterView.OnItemClickListener, AbsListView.OnItemLongClickListener { public static final int REQUEST_OAUTH = 10; private EditAccountsAdapter adapter; @@ -53,10 +52,6 @@ public class ManageAccountsActivity extends AppCompatActivity implements Adapter super.onCreate(savedInstanceState); setContentView(R.layout.layout_edit_list); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - ListView listView = (ListView) findViewById(R.id.listview_edit_list); adapter = new EditAccountsAdapter(); listView.setAdapter(adapter); diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.java index 6672843d..86883825 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/OAuthActivity.java @@ -24,10 +24,9 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; @@ -40,7 +39,7 @@ import net.lacolaco.smileessence.notification.Notificator; import net.lacolaco.smileessence.twitter.OAuthSession; import twitter4j.auth.AccessToken; -public class OAuthActivity extends AppCompatActivity implements View.OnClickListener, TextWatcher { +public class OAuthActivity extends Activity implements View.OnClickListener, TextWatcher { private TextView linkTextView; private EditText pinEditText; @@ -52,10 +51,6 @@ public class OAuthActivity extends AppCompatActivity implements View.OnClickList super.onCreate(savedInstanceState); setContentView(R.layout.layout_oauth); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - linkTextView = (TextView) findViewById(R.id.textView_oauth_link); pinEditText = (EditText) findViewById(R.id.editText_oauth_pin); pinEditText.addTextChangedListener(this); diff --git a/app/src/main/java/net/lacolaco/smileessence/activity/SettingActivity.java b/app/src/main/java/net/lacolaco/smileessence/activity/SettingActivity.java index ab383bb5..2cd63e49 100644 --- a/app/src/main/java/net/lacolaco/smileessence/activity/SettingActivity.java +++ b/app/src/main/java/net/lacolaco/smileessence/activity/SettingActivity.java @@ -24,15 +24,14 @@ package net.lacolaco.smileessence.activity; +import android.app.Activity; import android.os.Bundle; import android.support.v4.app.NavUtils; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; import android.view.MenuItem; import net.lacolaco.smileessence.Application; import net.lacolaco.smileessence.R; -public class SettingActivity extends AppCompatActivity { +public class SettingActivity extends Activity { // ------------------------ OVERRIDE METHODS ------------------------ @@ -41,10 +40,6 @@ public class SettingActivity extends AppCompatActivity { setTheme(Application.getThemeResId()); super.onCreate(savedInstanceState); setContentView(R.layout.layout_setting); - - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); } @Override diff --git a/app/src/main/java/net/lacolaco/smileessence/notification/Notificator.java b/app/src/main/java/net/lacolaco/smileessence/notification/Notificator.java index 435496ad..ef2e0868 100644 --- a/app/src/main/java/net/lacolaco/smileessence/notification/Notificator.java +++ b/app/src/main/java/net/lacolaco/smileessence/notification/Notificator.java @@ -29,7 +29,6 @@ import android.widget.Toast; import de.keyboardsurfer.android.widget.crouton.Configuration; import de.keyboardsurfer.android.widget.crouton.Crouton; import de.keyboardsurfer.android.widget.crouton.Style; -import net.lacolaco.smileessence.R; import net.lacolaco.smileessence.logging.Logger; import net.lacolaco.smileessence.util.UIHandler; @@ -73,7 +72,7 @@ public class Notificator { new UIHandler().post(() -> { if (isForeground) { Logger.debug(String.format("notify by crouton %s", text)); - Crouton.makeText(activity, text, getStyle(type), R.id.main_layout).show(); + Crouton.makeText(activity, text, getStyle(type)).show(); } else { Logger.debug(String.format("notify by toast %s", text)); Toast.makeText(activity, text, Toast.LENGTH_LONG).show(); |