From b3ee4188c2a78f96775e5db2cd89fe153cd1be4e Mon Sep 17 00:00:00 2001 From: Niklas Sombert Date: Thu, 17 Jan 2019 15:04:17 +0100 Subject: [PATCH] Remove code specific to pre-Holo versions of Android. --- .../java/de/chaosdorf/meteroid/BuyDrink.java | 43 +------------------ .../de/chaosdorf/meteroid/PickUsername.java | 29 +------------ .../de/chaosdorf/meteroid/SetHostname.java | 9 ++-- .../de/chaosdorf/meteroid/UserSettings.java | 15 +++---- .../main/res/layout/activity_buy_drink.xml | 37 ---------------- .../res/layout/activity_pick_username.xml | 24 ----------- 6 files changed, 13 insertions(+), 144 deletions(-) diff --git a/meteroid/src/main/java/de/chaosdorf/meteroid/BuyDrink.java b/meteroid/src/main/java/de/chaosdorf/meteroid/BuyDrink.java index c3086f6..3efc347 100644 --- a/meteroid/src/main/java/de/chaosdorf/meteroid/BuyDrink.java +++ b/meteroid/src/main/java/de/chaosdorf/meteroid/BuyDrink.java @@ -101,47 +101,8 @@ protected void onCreate(final Bundle savedInstanceState) barcodeIntegrator = new IntentIntegrator(this); - binding.buttonBack.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - pickUsername(); - } - }); - - binding.buttonReload.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - reload(); - } - }); - - binding.buttonEdit.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - Utility.startActivity(activity, UserSettings.class); - } - }); - - binding.buttonBarcode.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - scanBarcode(); - } - }); - - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - { - ActionBar actionBar = getActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); - binding.buttonReload.setVisibility(View.GONE); - binding.buttonBack.setVisibility(View.GONE); - binding.buttonEdit.setVisibility(View.GONE); - binding.buttonBarcode.setVisibility(View.GONE); - } + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { diff --git a/meteroid/src/main/java/de/chaosdorf/meteroid/PickUsername.java b/meteroid/src/main/java/de/chaosdorf/meteroid/PickUsername.java index 0b0371c..13542da 100644 --- a/meteroid/src/main/java/de/chaosdorf/meteroid/PickUsername.java +++ b/meteroid/src/main/java/de/chaosdorf/meteroid/PickUsername.java @@ -71,29 +71,8 @@ protected void onCreate(final Bundle savedInstanceState) super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout.activity_pick_username); - binding.buttonBack.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - Utility.startActivity(activity, SetHostname.class); - } - }); - - binding.buttonReload.setOnClickListener(new View.OnClickListener() - { - public void onClick(View view) - { - reload(); - } - }); - - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) - { - ActionBar actionBar = getActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); - binding.buttonReload.setVisibility(View.GONE); - binding.buttonBack.setVisibility(View.GONE); - } + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { @@ -211,10 +190,6 @@ public void processIOResult(final LongRunningIOTask task, final List resul { final List itemList = result; editHostnameOnBackButton = false; - if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) - { - itemList.add(new User(config.NO_USER_ID, getResources().getString(R.string.pick_username_new_user), "", 0, true, false, true)); - } final UserAdapter userAdapter = new UserAdapter(itemList); binding.gridView.setAdapter(userAdapter); diff --git a/meteroid/src/main/java/de/chaosdorf/meteroid/SetHostname.java b/meteroid/src/main/java/de/chaosdorf/meteroid/SetHostname.java index 3653b88..58ef857 100644 --- a/meteroid/src/main/java/de/chaosdorf/meteroid/SetHostname.java +++ b/meteroid/src/main/java/de/chaosdorf/meteroid/SetHostname.java @@ -80,13 +80,10 @@ public void onClick(View view) } }); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) + ActionBar actionBar = getActionBar(); + if(actionBar != null) { - ActionBar actionBar = getActionBar(); - if(actionBar != null) - { - binding.buttonSave.setVisibility(View.GONE); - } + binding.buttonSave.setVisibility(View.GONE); } } diff --git a/meteroid/src/main/java/de/chaosdorf/meteroid/UserSettings.java b/meteroid/src/main/java/de/chaosdorf/meteroid/UserSettings.java index 8c1a2bc..840a495 100644 --- a/meteroid/src/main/java/de/chaosdorf/meteroid/UserSettings.java +++ b/meteroid/src/main/java/de/chaosdorf/meteroid/UserSettings.java @@ -93,16 +93,13 @@ public void onClick(View view) } }); - if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) + ActionBar actionBar = getActionBar(); + if(actionBar != null) { - ActionBar actionBar = getActionBar(); - if(actionBar != null) - { - actionBar.setDisplayHomeAsUpEnabled(true); - binding.buttonBack.setVisibility(View.GONE); - binding.buttonDelete.setVisibility(View.GONE); - binding.buttonSave.setVisibility(View.GONE); - } + actionBar.setDisplayHomeAsUpEnabled(true); + binding.buttonBack.setVisibility(View.GONE); + binding.buttonDelete.setVisibility(View.GONE); + binding.buttonSave.setVisibility(View.GONE); } makeReadOnly(); diff --git a/meteroid/src/main/res/layout/activity_buy_drink.xml b/meteroid/src/main/res/layout/activity_buy_drink.xml index 5ae4f9a..78ec6d5 100644 --- a/meteroid/src/main/res/layout/activity_buy_drink.xml +++ b/meteroid/src/main/res/layout/activity_buy_drink.xml @@ -62,43 +62,6 @@ android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> - - - - - - - - - - - - - - - - - - - - -