Migrate to ButterKnife 7.0.1 & use joda-time 2.8.1 and otto 1.3.8

This commit is contained in:
ligi 2015-07-10 15:32:54 +02:00
parent 84806f3162
commit 4c4c7f555a
14 changed files with 87 additions and 90 deletions

View file

@ -113,9 +113,9 @@ dependencies {
compile 'com.googlecode.android-query:android-query:0.25.9'
compile 'com.google.code.gson:gson:2.3.1'
compile 'net.lingala.zip4j:zip4j:1.3.2'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'net.danlew:android.joda:2.8.0'
compile 'com.squareup:otto:1.3.7'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'net.danlew:android.joda:2.8.1'
compile 'com.squareup:otto:1.3.8'
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.android.support:support-v4:22.2.0'

View file

@ -75,7 +75,8 @@ public class AppleStylePassReader {
try {
final String json_str = AXT.at(file).readToString(charset);
pass_json = SafeJSONReader.readJSONSafely(json_str);
} catch (Exception e) {
} catch (Exception ignored) {
// we try with next charset
}
if (pass_json != null) {
@ -202,7 +203,7 @@ public class AppleStylePassReader {
}
} else try {
type_json = pass_json.getJSONObject(pass.getType());
} catch (JSONException e) {
} catch (JSONException ignored) {
}
}
@ -218,7 +219,7 @@ public class AppleStylePassReader {
try {
pass.setOrganisation(pass_json.getString("organizationName"));
Tracker.get().trackEvent("measure_event", "organisation_parse", pass.getOrganisation(), 1L);
} catch (JSONException e) {
} catch (JSONException ignored) {
// ok - we have no organisation - big deal ..-)
}

View file

@ -7,8 +7,8 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.google.zxing.BarcodeFormat;
import org.ligi.axt.AXT;
import org.ligi.passandroid.R;
@ -16,10 +16,10 @@ import org.ligi.tracedroid.logging.Log;
public class FullscreenBarcodeActivity extends PassViewActivityBase {
@InjectView(R.id.fullscreen_barcode)
@Bind(R.id.fullscreen_barcode)
ImageView barcodeImageView;
@InjectView(R.id.alternativeBarcodeText)
@Bind(R.id.alternativeBarcodeText)
TextView alternativeBarcodeText;
@ -28,7 +28,7 @@ public class FullscreenBarcodeActivity extends PassViewActivityBase {
super.onCreate(savedInstanceState);
setContentView(R.layout.fullscreen_image);
ButterKnife.inject(this);
ButterKnife.bind(this);
}
@Override

View file

@ -7,20 +7,20 @@ import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.MenuItem;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import org.ligi.passandroid.R;
public class HelpActivity extends AppCompatActivity {
@InjectView(R.id.help_tv)
@Bind(R.id.help_tv)
TextView helpTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
ButterKnife.inject(this);
ButterKnife.bind(this);
helpTextView.setText(Html.fromHtml(getString(R.string.help_content)));

View file

@ -11,9 +11,11 @@ import android.view.ViewGroup;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.squareup.otto.Subscribe;
import java.util.List;
import org.ligi.axt.AXT;
import org.ligi.axt.listeners.RepeatedOnClicksListener;
import org.ligi.passandroid.App;
@ -25,13 +27,6 @@ import org.ligi.passandroid.helper.CategoryHelper;
import org.ligi.passandroid.model.PassStore;
import org.ligi.passandroid.ui.views.CategoryIndicatorView;
import org.ligi.tracedroid.logging.Log;
import java.util.List;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
@ -47,19 +42,19 @@ public class NavigationFragment extends Fragment {
AXT.at(getActivity()).startCommonIntent().shareUrl(getMarketUrl());
}
@InjectView(R.id.radioGroup)
@Bind(R.id.radioGroup)
RadioGroup radioGroup;
@InjectView(R.id.categoryRadioButton)
@Bind(R.id.categoryRadioButton)
RadioButton categoryRadioButton;
@InjectView(R.id.dateRadioButton)
@Bind(R.id.dateRadioButton)
RadioButton dateRadioButton;
@InjectView(R.id.navCategoriesInner)
@Bind(R.id.navCategoriesInner)
ViewGroup categoriesContainer;
@InjectView(R.id.navCategoriesOuter)
@Bind(R.id.navCategoriesOuter)
View categoriesContainerOuter;
@Override
@ -70,7 +65,7 @@ public class NavigationFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.fragment_navigation, container, false);
ButterKnife.inject(this, view);
ButterKnife.bind(this, view);
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
@ -128,11 +123,12 @@ public class NavigationFragment extends Fragment {
private boolean shouldDisplaySort() {
return App.getPassStore().getCountedTypes().size() >= 2;
}
private void setCategoryNavVisibilityByCurrentConditions() {
categoriesContainerOuter.setVisibility(shouldDisplayCategoryNav()? VISIBLE: GONE);
categoriesContainer.setVisibility(shouldDisplayCategoryNav()? VISIBLE: GONE);
radioGroup.setVisibility(shouldDisplaySort()? VISIBLE: GONE);
private void setCategoryNavVisibilityByCurrentConditions() {
categoriesContainerOuter.setVisibility(shouldDisplayCategoryNav() ? VISIBLE : GONE);
categoriesContainer.setVisibility(shouldDisplayCategoryNav() ? VISIBLE : GONE);
radioGroup.setVisibility(shouldDisplaySort() ? VISIBLE : GONE);
}
private void createCategoryJumpMarks(LayoutInflater inflater) {
@ -146,7 +142,7 @@ public class NavigationFragment extends Fragment {
for (PassStore.CountedType countedType : countedTypes) {
final String type = countedType.type;
final View item = inflater.inflate(R.layout.item_nav_pass_category, categoriesContainer,false);
final View item = inflater.inflate(R.layout.item_nav_pass_category, categoriesContainer, false);
// gather views
final CategoryIndicatorView categoryIndicatorView = ButterKnife.findById(item, R.id.categoryView);

View file

@ -8,8 +8,8 @@ import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.squareup.otto.Subscribe;
import com.viewpagerindicator.TitlePageIndicator;
import org.ligi.axt.AXT;
@ -26,10 +26,10 @@ import org.ligi.passandroid.ui.edit_fragments.MetaDataFragment;
public class PassEditActivity extends AppCompatActivity {
@InjectView(R.id.passEditPager)
@Bind(R.id.passEditPager)
ViewPager viewPager;
@InjectView(R.id.titlesViewPagerIndicator)
@Bind(R.id.titlesViewPagerIndicator)
TitlePageIndicator titlePageIndicator;
private PassImpl pass;
@ -38,7 +38,7 @@ public class PassEditActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.edit);
ButterKnife.inject(this);
ButterKnife.bind(this);
final Pass currentPass = App.getPassStore().getCurrentPass();
if (currentPass != null) {

View file

@ -16,8 +16,8 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import com.androidquery.service.MarketService;
import com.squareup.otto.Subscribe;
@ -45,16 +45,16 @@ public class PassListActivity extends AppCompatActivity {
private ActionBarDrawerToggle drawerToggle;
@InjectView(R.id.content_list)
@Bind(R.id.content_list)
RecyclerView recyclerView;
@InjectView(R.id.drawer_layout)
@Bind(R.id.drawer_layout)
DrawerLayout drawer;
@InjectView(R.id.emptyView)
@Bind(R.id.emptyView)
TextView emptyView;
@InjectView(R.id.fam)
@Bind(R.id.fam)
FloatingActionsMenu floatingActionsMenu;
@OnClick(R.id.fab_action_create_pass)
@ -81,7 +81,7 @@ public class PassListActivity extends AppCompatActivity {
}
@InjectView(R.id.fab_action_open_file)
@Bind(R.id.fab_action_open_file)
FloatingActionButton openFileFAB;
public final static int VERSION_STARTING_TO_SUPPORT_STORAGE_FRAMEWORK = 19;
@ -149,7 +149,7 @@ public class PassListActivity extends AppCompatActivity {
getSupportFragmentManager().beginTransaction().add(R.id.left_drawer, new NavigationFragment()).commitAllowingStateLoss();
ButterKnife.inject(this);
ButterKnife.bind(this);
AXT.at(openFileFAB).setVisibility(Build.VERSION.SDK_INT >= VERSION_STARTING_TO_SUPPORT_STORAGE_FRAMEWORK);

View file

@ -17,8 +17,8 @@ import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import org.ligi.axt.AXT;
import org.ligi.passandroid.R;
@ -45,31 +45,31 @@ public class PassViewActivity extends PassViewActivityBase {
}
}
@InjectView(R.id.moreTextView)
@Bind(R.id.moreTextView)
TextView moreTextView;
@InjectView(R.id.barcode_img)
@Bind(R.id.barcode_img)
ImageView barcode_img;
@InjectView(R.id.logo_img)
@Bind(R.id.logo_img)
ImageView logo_img;
@InjectView(R.id.footer_img)
@Bind(R.id.footer_img)
ImageView footer_img;
@InjectView(R.id.thumbnail_img)
@Bind(R.id.thumbnail_img)
ImageView thumbnail_img;
@InjectView(R.id.strip_img)
@Bind(R.id.strip_img)
ImageView strip_img;
@InjectView(R.id.back_fields)
@Bind(R.id.back_fields)
TextView back_tv;
@InjectView(R.id.front_field_container)
@Bind(R.id.front_field_container)
ViewGroup frontFieldsContainer;
@InjectView(R.id.barcode_alt_text)
@Bind(R.id.barcode_alt_text)
TextView barcodeAlternativeText;
@Override
@ -89,7 +89,7 @@ public class PassViewActivity extends PassViewActivityBase {
final View passExtrasView = getLayoutInflater().inflate(R.layout.pass_view_extra_data, extraViewContainer, false);
extraViewContainer.addView(passExtrasView);
ButterKnife.inject(this);
ButterKnife.bind(this);
refresh();
}
@ -166,7 +166,7 @@ public class PassViewActivity extends PassViewActivityBase {
final ViewGroup extraViewContainer = (ViewGroup) findViewById(R.id.passExtrasContainer);
getLayoutInflater().inflate(R.layout.pass_view_extra_data, extraViewContainer);
ButterKnife.inject(this);
ButterKnife.bind(this);
}

View file

@ -13,8 +13,8 @@ import android.text.format.DateUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import org.joda.time.DateTime;
import org.ligi.passandroid.R;
@ -28,22 +28,22 @@ public class PassViewHolder extends RecyclerView.ViewHolder {
final CardView root;
@InjectView(R.id.icon)
@Bind(R.id.icon)
ImageView icon;
@InjectView(R.id.date)
@Bind(R.id.date)
TextView date;
@InjectView(R.id.title)
@Bind(R.id.title)
TextView title;
@InjectView(R.id.categoryView)
@Bind(R.id.categoryView)
CategoryIndicatorView category;
@InjectView(R.id.actions_separator)
@Bind(R.id.actions_separator)
View actionsSeparator;
@InjectView(R.id.navigateTo)
@Bind(R.id.navigateTo)
TextView navigateTo;
@OnClick(R.id.navigateTo)
@ -51,7 +51,7 @@ public class PassViewHolder extends RecyclerView.ViewHolder {
NavigateToLocationsDialog.perform(activity, pass, false);
}
@InjectView(R.id.addCalendar)
@Bind(R.id.addCalendar)
TextView addCalendar;
@OnClick(R.id.addCalendar)
@ -71,7 +71,7 @@ public class PassViewHolder extends RecyclerView.ViewHolder {
public PassViewHolder(View view) {
super(view);
root = (CardView) view;
ButterKnife.inject(this, view);
ButterKnife.bind(this, view);
}
public void apply(final Pass pass, final Activity activity) {
@ -105,9 +105,9 @@ public class PassViewHolder extends RecyclerView.ViewHolder {
title.setText(pass.getDescription());
if (pass.getRelevantDate() != null) {
setDateTextFromDateAndPrefix("",pass.getRelevantDate());
setDateTextFromDateAndPrefix("", pass.getRelevantDate());
} else if (pass.getExpirationDate() != null) {
setDateTextFromDateAndPrefix(pass.getExpirationDate().isAfterNow()?"expires ":" expired ",pass.getExpirationDate());
setDateTextFromDateAndPrefix(pass.getExpirationDate().isAfterNow() ? "expires " : " expired ", pass.getExpirationDate());
} else {
date.setVisibility(GONE);
}

View file

@ -15,8 +15,8 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import com.google.zxing.BarcodeFormat;
import java.util.Collections;
@ -55,31 +55,31 @@ public class BarcodeEditFragment extends Fragment {
super.onActivityResult(requestCode, resultCode, data);
}
@InjectView(R.id.selectorQR)
@Bind(R.id.selectorQR)
ImageView selectorQR;
@InjectView(R.id.selectorPDF417)
@Bind(R.id.selectorPDF417)
ImageView selectorPDF417;
@InjectView(R.id.selectorAZTEC)
@Bind(R.id.selectorAZTEC)
ImageView selectorAztec;
@InjectView(R.id.messageInput)
@Bind(R.id.messageInput)
EditText messageInput;
@InjectView(R.id.alternativeMessageInput)
@Bind(R.id.alternativeMessageInput)
EditText alternativeMessageInput;
@InjectView(R.id.PDFCheck)
@Bind(R.id.PDFCheck)
RadioButton pdfCheck;
@InjectView(R.id.QRCheck)
@Bind(R.id.QRCheck)
RadioButton qrCheck;
@InjectView(R.id.AZTecCheck)
@Bind(R.id.AZTecCheck)
RadioButton aztecCheck;
@InjectView(R.id.barcodeTypeRadioGroup)
@Bind(R.id.barcodeTypeRadioGroup)
RadioGroup typeGroup;
private final PassImpl pass;
@ -98,14 +98,14 @@ public class BarcodeEditFragment extends Fragment {
}
final View inflate = inflater.inflate(R.layout.edit_barcode, container, false);
ButterKnife.inject(this, inflate);
ButterKnife.bind(this, inflate);
final Display display = getActivity().getWindowManager().getDefaultDisplay();
barcodeSize = display.getWidth() / 3;
final BarCode barCode = pass.getBarCode();
if (barCode!=null) {
if (barCode != null) {
messageInput.setText(barCode.getMessage());
final String alternativeTextOptional = barCode.getAlternativeText();

View file

@ -6,8 +6,8 @@ import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.larswerkman.holocolorpicker.ColorPicker;
import org.ligi.passandroid.App;
import org.ligi.passandroid.R;
@ -16,7 +16,7 @@ import org.ligi.passandroid.model.PassImpl;
public class ColorPickFragment extends Fragment {
@InjectView(R.id.colorPicker)
@Bind(R.id.colorPicker)
ColorPicker colorPicker;
private final PassImpl pass;
@ -28,7 +28,7 @@ public class ColorPickFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.edit_color, container, false);
ButterKnife.inject(this, view);
ButterKnife.bind(this, view);
colorPicker.setOldCenterColor(pass.getBackgroundColor());

View file

@ -60,7 +60,7 @@ public class ImageEditFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View inflate = inflater.inflate(R.layout.edit_images, container, false);
ButterKnife.inject(this, inflate);
ButterKnife.bind(this, inflate);
return inflate;
}

View file

@ -12,8 +12,8 @@ import android.view.ViewGroup;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import org.joda.time.DateTime;
import org.ligi.axt.simplifications.SimpleTextWatcher;
@ -24,7 +24,7 @@ import org.ligi.passandroid.model.PassImpl;
public class MetaDataFragment extends Fragment implements TimePickerDialog.OnTimeSetListener, DatePickerDialog.OnDateSetListener {
@InjectView(R.id.descriptionEdit)
@Bind(R.id.descriptionEdit)
EditText descriptionEdit;
private DateTime time;
@ -54,7 +54,7 @@ public class MetaDataFragment extends Fragment implements TimePickerDialog.OnTim
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View inflate = inflater.inflate(R.layout.edit_meta_data, container, false);
ButterKnife.inject(this, inflate);
ButterKnife.bind(this, inflate);
descriptionEdit.setText(pass.getDescription());
descriptionEdit.addTextChangedListener(new SimpleTextWatcher() {

View file

@ -8,19 +8,19 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import butterknife.Bind;
import org.ligi.passandroid.R;
import org.ligi.passandroid.helper.CategoryHelper;
import butterknife.ButterKnife;
import butterknife.InjectView;
public class CategoryIndicatorView extends LinearLayout {
@InjectView(R.id.categoryExtraText)
@Bind(R.id.categoryExtraText)
TextView extraText;
@InjectView(R.id.topImageView)
@Bind(R.id.topImageView)
ImageView topImageView;
public CategoryIndicatorView(Context context) {
@ -31,7 +31,7 @@ public class CategoryIndicatorView extends LinearLayout {
super(context, attrs);
setOrientation(VERTICAL);
LayoutInflater.from(context).inflate(R.layout.category_indicator, this, true);
ButterKnife.inject(this);
ButterKnife.bind(this);
}
public void setImageByCategory(String category) {