mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-05-18 13:49:15 -04:00
Make it easy to add extra barcodes
This commit is contained in:
@@ -57,6 +57,7 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
|
||||
|
||||
int loyaltyCardId;
|
||||
boolean updateLoyaltyCard;
|
||||
String loyaltyCardStorePrefill = "";
|
||||
Uri importLoyaltyCardUri = null;
|
||||
Integer headingColorValue = null;
|
||||
Integer headingStoreTextColorValue = null;
|
||||
@@ -69,6 +70,7 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
|
||||
final Bundle b = intent.getExtras();
|
||||
loyaltyCardId = b != null ? b.getInt("id") : 0;
|
||||
updateLoyaltyCard = b != null && b.getBoolean("update", false);
|
||||
loyaltyCardStorePrefill = b != null ? b.getString("store", "") : "";
|
||||
importLoyaltyCardUri = intent.getData();
|
||||
|
||||
Log.d(TAG, "View activity: id=" + loyaltyCardId
|
||||
@@ -209,6 +211,12 @@ public class LoyaltyCardEditActivity extends AppCompatActivity
|
||||
setTitle(R.string.addCardTitle);
|
||||
}
|
||||
|
||||
// Set prefill values if nothing is set
|
||||
if(storeFieldEdit.getText().length() == 0 && !loyaltyCardStorePrefill.isEmpty())
|
||||
{
|
||||
storeFieldEdit.setText(loyaltyCardStorePrefill);
|
||||
}
|
||||
|
||||
if(headingColorValue == null)
|
||||
{
|
||||
// Select a random color to start out with.
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
|
||||
@@ -39,6 +40,7 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
private static final String TAG = "CardLocker";
|
||||
private static final double LUMINANCE_MIDPOINT = 0.5;
|
||||
|
||||
FloatingActionButton FabAdd;
|
||||
TabLayout tabLayout;
|
||||
TabLayout.OnTabSelectedListener onTabSelectedListener;
|
||||
TextView cardIdFieldView;
|
||||
@@ -102,6 +104,19 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
db = new DBHelper(this);
|
||||
importURIHelper = new ImportURIHelper(this);
|
||||
|
||||
FabAdd = findViewById(R.id.fabAdd);
|
||||
FabAdd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
Intent intent = new Intent(getApplicationContext(), LoyaltyCardEditActivity.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("store", loyaltyCard.store);
|
||||
intent.putExtras(bundle);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
tabLayout = findViewById(R.id.tabLayout);
|
||||
onTabSelectedListener = new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
@@ -286,7 +301,7 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
}
|
||||
else
|
||||
{
|
||||
findViewById(R.id.barcode).setVisibility(View.GONE);
|
||||
findViewById(R.id.barcode).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@
|
||||
android:fitsSystemWindows="true"
|
||||
>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fabAdd"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end|bottom"
|
||||
android:src="@drawable/ic_add_white_24dp"
|
||||
android:contentDescription="@string/action_add"
|
||||
android:layout_margin="16dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
@@ -37,6 +46,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorAnimationDuration="0"
|
||||
app:tabMode="scrollable"/>
|
||||
|
||||
<ImageView
|
||||
|
||||
Reference in New Issue
Block a user