Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omni cg banner view #628

Merged
merged 73 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d0cbe30
MOB-5132: Fix deep link issue after app is opened from notification
devcsomnicg Apr 6, 2023
47ca7c1
Merge branch 'Iterable:master' into master
devcsomnicg Jun 2, 2023
d560a2d
Merge branch 'master' into master
Ayyanchira Jun 21, 2023
2bc666d
banner-view-implementation
Sagarpatel14 Jul 13, 2023
69e9ec8
Merge pull request #598 from devcsomnicg/banner-view
evantk91 Sep 8, 2023
6c293ff
minor edits
Sep 8, 2023
ed8d4b9
README updates
bradumbaugh Feb 2, 2023
f9fc218
sets custom sound at notification channel
evantk91 Jan 9, 2023
4116aad
updates notification channel builder to set sound
evantk91 Jan 10, 2023
3deabed
minor edits
evantk91 Jan 10, 2023
52242b9
sets sound at notification channel
evantk91 Jan 11, 2023
a1c80bd
minor edits
evantk91 Jan 11, 2023
61b04dc
sets up channel id and channel name for each unique sound
evantk91 Jan 15, 2023
dd6ad96
adds conditionals for default channel creation
evantk91 Jan 15, 2023
40a055f
investigating edge cases
evantk91 Jan 15, 2023
ead6a81
debugging
evantk91 Jan 15, 2023
b36b2c0
adds default sounds for edge cases
evantk91 Jan 15, 2023
5135535
adds default channel id and channel name for edge cases
evantk91 Jan 16, 2023
12cede5
minor edits
evantk91 Jan 16, 2023
23650eb
minor edits
evantk91 Jan 16, 2023
488e920
cleans up conditionals
evantk91 Jan 16, 2023
c56b637
reorganizes and checks resources folder for matching sound file
evantk91 Jan 17, 2023
33ce38d
minor edits
evantk91 Jan 17, 2023
14a8e17
minor edits
evantk91 Jan 17, 2023
dccb6af
minor edits
evantk91 Jan 17, 2023
9d07396
updates channel names to sound names
evantk91 Jan 17, 2023
9642326
resolves null pointer exception for soundName
evantk91 Jan 20, 2023
fecf985
removes unneccessary package from build.gradle
evantk91 Jan 20, 2023
4766016
[MOB-5532] - Adding remote notification sound
Jan 31, 2023
7534231
ChannelId was getting set to null when no sound
Jan 31, 2023
cb0c71d
Remove all other channels which are not active
Jan 31, 2023
5c677d8
Checkstyle fix
Jan 31, 2023
9bdb140
adds resource check for existing local sound and updates soundName ch…
evantk91 Jan 31, 2023
bf12e61
adds soundId and soundUrl checks for channel id and channel name
evantk91 Jan 31, 2023
8aa9a30
passes soundId down to getSoundUri
evantk91 Jan 31, 2023
a2ae58d
Revert "passes soundId down to getSoundUri"
evantk91 Jan 31, 2023
021e3a7
adds null check to getSoundUri
evantk91 Jan 31, 2023
40b0505
checkstyle fix
evantk91 Jan 31, 2023
b6d899f
puts sound uri check in createNotificationChannel
evantk91 Jan 31, 2023
8478d92
reorganizes to do the Uri logic in getSoundUri
evantk91 Jan 31, 2023
0e466e1
checkstyle fixes
evantk91 Feb 1, 2023
136a052
addresses comments
evantk91 Feb 1, 2023
64681d4
reverts back to not deleting inactive channels
evantk91 Feb 2, 2023
3fc1370
Update iterableapi/src/main/java/com/iterable/iterableapi/IterableNot…
evangreer91 Feb 16, 2023
f842b01
addresses code climate fixes
evantk91 Feb 16, 2023
1f4d1c0
[MOB-5664] - Revert channel name implementation
Ayyanchira Feb 21, 2023
246f063
Log warn instead of error
Ayyanchira Feb 26, 2023
2eb3cb7
[MOB - 5694] - Add try catch around animation
Feb 26, 2023
d84b57e
Add firetv/ott support to getmessages call
amanforindia Mar 15, 2023
a5c5822
For firetv call update user with device details upon initialization
amanforindia Mar 16, 2023
4e6a3ed
Set DEVICE_NOTIFICATIONS_ENABLED key only when registering for push
amanforindia Mar 16, 2023
981747e
Fix firetv object structure
amanforindia Mar 20, 2023
9fce0b6
Review fixes
amanforindia Mar 21, 2023
21637c2
[MOB - 5873] - Public getters for Email UserID and Auth
Mar 22, 2023
91dd915
[MOB - 5874] - Schedule auth refresh when auth null
Mar 22, 2023
52f2bed
add private constructor to prevent instance creation
devcsomnicg Apr 14, 2023
9691ac6
update unit test
devcsomnicg Apr 14, 2023
ac2a92e
Added import for DeviceInfoUtils
devcsomnicg Apr 18, 2023
3605c0f
create issue in jira when github issue opened
dontgitit Apr 13, 2023
7a03ccf
update secret names
dontgitit Apr 13, 2023
539d067
Merge pull request #474 from Iterable/jay/MOB-4666-in-apps-config-memory
May 2, 2023
eb8348c
CI fix
May 2, 2023
e1ee03d
[MOB-6055] - [OMNI CG] - Add callbacks to setting email/user id (#570)
Ayyanchira May 17, 2023
cc1d96e
[MOB 5730] Add callbacks to reading/removing in-app messages (#557) (…
Ayyanchira Jun 14, 2023
575026d
[MOB - 6493] - Message read and remove bug fix (#592)
Ayyanchira Jul 12, 2023
b8fc54a
MOB-5132: Fix deep link issue after app is opened from notification (…
Ayyanchira Jul 12, 2023
eee1b76
[MOB-6309] prepares EUDC updates for release (#572)
evantk91 Jul 17, 2023
355db54
removes extra dependency (#609)
evantk91 Jul 28, 2023
275c4f1
MOB-5132 (#613)
devcsomnicg Aug 29, 2023
2ad7c47
Ensure IterableTrampolineActivity always launched (#553) (#618)
Ayyanchira Aug 31, 2023
eccff7f
banner-view-implementation
Sagarpatel14 Jul 13, 2023
c3588ed
Merge branch 'omni-cg-banner-view' of github.com:Iterable/iterable-an…
Sep 8, 2023
7cfda9f
Merge branch 'evan/feature/OOTB-support' into omni-cg-banner-view
Sep 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions app/src/main/java/com/iterable/androidsdk/BannerView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.iterable.androidsdk;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.GradientDrawable;
import android.os.Message;
import android.os.Messenger;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.ImageView;


import androidx.cardview.widget.CardView;


import com.squareup.picasso.Picasso;

public class BannerView extends CardView {

private TextView titleText;
private TextView descriptionText;
private ImageView image;
private CardView cardView;
private Button primaryButton;
private Button secondaryButton;

public BannerView(Context context) {
super(context);
init();
}

public BannerView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}

public BannerView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}

private void init() {
inflate(getContext(), R.layout.banner_view, this);
titleText = findViewById(R.id.titleText);
descriptionText = findViewById(R.id.descriptionText);
image = findViewById(R.id.image);
cardView = findViewById(R.id.banner_view);
primaryButton = findViewById(R.id.primaryButton);
secondaryButton = findViewById(R.id.secondaryButton);
this.updateValues();
}

public void updateValues() {

// Retrieve the passed values from the intent
Intent intent = ((Activity) getContext()).getIntent();

//card config
cardView.setRadius(intent.getIntExtra("cardRadius", 4));
cardView.setCardBackgroundColor(intent.getIntExtra("cardBackgroundColor", Color.parseColor("#ffffff")));

//title of the card
titleText.setText(intent.getStringExtra("titleText"));
titleText.setTextSize(intent.getIntExtra("titleTextSize", 20));
titleText.setTextColor(intent.getIntExtra("titleTextColor", Color.parseColor("#000000")));

//description of the card
descriptionText.setText(intent.getStringExtra("descriptionText"));
descriptionText.setTextSize(intent.getIntExtra("descriptionTextSize", 16));
descriptionText.setTextColor(intent.getIntExtra("descriptionTextColor", Color.parseColor("#000000")));

//primary button of the card
primaryButton.setText(intent.getStringExtra("primaryButtonText"));
primaryButton.setTextColor(intent.getIntExtra("primaryButtonTextColor", Color.parseColor("#ffffff")));

//secondary button of the card
secondaryButton.setText(intent.getStringExtra("secondaryButtonText"));
secondaryButton.setTextColor(intent.getIntExtra("secondaryButtonTextColor", Color.parseColor("#000000")));

//secondary button visibility
if (intent.getBooleanExtra("secondaryButtonVisible", true)) {
secondaryButton.setVisibility(View.VISIBLE);
} else {
secondaryButton.setVisibility(View.GONE);
}

// Get the current background drawable of the button
GradientDrawable backgroundDrawable = (GradientDrawable) primaryButton.getBackground();
backgroundDrawable.setCornerRadius(intent.getIntExtra("primaryButtonRadius", 50));
primaryButton.getBackground().setColorFilter((intent.getIntExtra("primaryButtonBackgroundColor", Color.parseColor("#FF4081"))), PorterDuff.Mode.SRC);
primaryButton.setBackground(backgroundDrawable);

// card image
if (!intent.getStringExtra("imageUrl").isEmpty()) {
Picasso.get().load(intent.getStringExtra("imageUrl")).into(image);
}

// Get the current layout params of the card image
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) image.getLayoutParams();
layoutParams.width = intent.getIntExtra("imageWidth", LinearLayout.LayoutParams.WRAP_CONTENT);
layoutParams.height = intent.getIntExtra("imageHeight", LinearLayout.LayoutParams.WRAP_CONTENT);
image.setLayoutParams(layoutParams);

primaryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Get the messenger from the intent
Messenger messenger = intent.getParcelableExtra("messenger");

// Send a message to the main activity
Message message = new Message();
message.what = 1;
message.obj = "Primary Button clicked";
try {
messenger.send(message);
} catch (Exception e) {
// Handle the exception
}
}
});

secondaryButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Get the messenger from the intent
Messenger messenger = intent.getParcelableExtra("messenger");

// Send a message to the main activity
Message message = new Message();
message.what = 1;
message.obj = "Secondary Button clicked";
try {
messenger.send(message);
} catch (Exception e) {
// Handle the exception
}
}
});

}
}
12 changes: 12 additions & 0 deletions app/src/main/java/com/iterable/androidsdk/BannerViewActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.iterable.androidsdk;

import android.app.Activity;
import android.os.Bundle;

public class BannerViewActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_banner_view);
}
}
Binary file added app/src/main/res/drawable/dummy_100x100.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/src/main/res/layout/activity_banner_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<com.example.filterable_android_sdk.BannerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/banner_view_activity"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- Customize the layout of your CustomCardView activity here -->

</com.example.filterable_android_sdk.BannerView>
100 changes: 100 additions & 0 deletions app/src/main/res/layout/banner_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/banner_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="4dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">

<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="Banner Title"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold" />

<TextView
android:id="@+id/descriptionText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:text="@string/card_description_character_description_is_a_type_of_writing_that_gives_the_reader_information_about_a_character_this_information_is_often_related_to_the_character_s_visual_appearanc"
android:textColor="@android:color/black"
android:textSize="14sp" />

</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Space
android:layout_width="5dp"
android:layout_height="wrap_content" />

<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="Logo"
android:scaleType="fitCenter"
android:src="@drawable/dummy_100x100" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal">

<Button
android:id="@+id/primaryButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_background"
android:minHeight="30dp"
android:padding="10dp"
android:text="Button 1"
android:textColor="#FFFFFF"
android:textSize="12sp" />

<Button
android:id="@+id/secondaryButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:background="@android:color/transparent"
android:minHeight="30dp"
android:padding="10dp"
android:text="Button 2"
android:textColor="#FF4081"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>

</androidx.cardview.widget.CardView>
Loading