-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
6,857 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
uikit/src/main/java/com/sendbird/uikit/activities/ChatNotificationChannelActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.sendbird.uikit.activities; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
import com.sendbird.uikit.R; | ||
import com.sendbird.uikit.SendbirdUIKit; | ||
import com.sendbird.uikit.consts.StringSet; | ||
import com.sendbird.uikit.utils.ContextUtils; | ||
import com.sendbird.uikit.utils.TextUtils; | ||
|
||
/** | ||
* Activity displays notifications of a channel by user. | ||
*/ | ||
public class ChatNotificationChannelActivity extends AppCompatActivity { | ||
|
||
/** | ||
* Create an intent for a {@link ChatNotificationChannelActivity}. | ||
* | ||
* @param context A Context of the application package implementing this class. | ||
* @param channelUrl the url of the channel will be implemented. | ||
* @return ChatNotificationChannelActivity Intent. | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
public static Intent newIntent(@NonNull Context context, @NonNull String channelUrl) { | ||
return newIntentFromCustomActivity(context, ChatNotificationChannelActivity.class, channelUrl); | ||
} | ||
|
||
/** | ||
* Create an intent for a custom activity. The custom activity must inherit {@link ChatNotificationChannelActivity}. | ||
* | ||
* @param context A Context of the application package implementing this class. | ||
* @param cls The activity class that is to be used for the intent. | ||
* @param channelUrl the url of the channel will be implemented. | ||
* @return Returns a newly created Intent that can be used to launch the activity. | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
public static Intent newIntentFromCustomActivity(@NonNull Context context, @NonNull Class<? extends ChatNotificationChannelActivity> cls, @NonNull String channelUrl) { | ||
Intent intent = new Intent(context, cls); | ||
intent.putExtra(StringSet.KEY_CHANNEL_URL, channelUrl); | ||
return intent; | ||
} | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setTheme(SendbirdUIKit.isDarkMode() ? R.style.AppTheme_Dark_Sendbird : R.style.AppTheme_Sendbird); | ||
setContentView(R.layout.sb_activity); | ||
|
||
String url = getIntent().getStringExtra(StringSet.KEY_CHANNEL_URL); | ||
if (TextUtils.isEmpty(url)) { | ||
ContextUtils.toastError(this, R.string.sb_text_error_get_channel); | ||
} else { | ||
Fragment fragment = createFragment(); | ||
FragmentManager manager = getSupportFragmentManager(); | ||
manager.popBackStack(); | ||
manager.beginTransaction() | ||
.replace(R.id.sb_fragment_container, fragment) | ||
.commit(); | ||
} | ||
} | ||
|
||
/** | ||
* It will be called when the {@link ChatNotificationChannelActivity} is being created. | ||
* The data contained in Intent is delivered to Fragment's Bundle. | ||
* | ||
* @return {@link com.sendbird.uikit.fragments.ChatNotificationChannelFragment} | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
protected Fragment createFragment() { | ||
final Bundle args = getIntent() != null && getIntent().getExtras() != null ? getIntent().getExtras() : new Bundle(); | ||
return SendbirdUIKit.getFragmentFactory().newChatNotificationChannelFragment(args.getString(StringSet.KEY_CHANNEL_URL, ""), args); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
uikit/src/main/java/com/sendbird/uikit/activities/FeedNotificationChannelActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.sendbird.uikit.activities; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
import com.sendbird.uikit.R; | ||
import com.sendbird.uikit.SendbirdUIKit; | ||
import com.sendbird.uikit.consts.StringSet; | ||
import com.sendbird.uikit.utils.ContextUtils; | ||
import com.sendbird.uikit.utils.TextUtils; | ||
|
||
/** | ||
* Activity displays notifications of a channel by user. | ||
*/ | ||
public class FeedNotificationChannelActivity extends AppCompatActivity { | ||
|
||
/** | ||
* Create an intent for a {@link FeedNotificationChannelActivity}. | ||
* | ||
* @param context A Context of the application package implementing this class. | ||
* @param channelUrl the url of the channel will be implemented. | ||
* @return FeedNotificationChannelActivity Intent. | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
public static Intent newIntent(@NonNull Context context, @NonNull String channelUrl) { | ||
return newIntentFromCustomActivity(context, FeedNotificationChannelActivity.class, channelUrl); | ||
} | ||
|
||
/** | ||
* Create an intent for a custom activity. The custom activity must inherit {@link FeedNotificationChannelActivity}. | ||
* | ||
* @param context A Context of the application package implementing this class. | ||
* @param cls The activity class that is to be used for the intent. | ||
* @param channelUrl the url of the channel will be implemented. | ||
* @return Returns a newly created Intent that can be used to launch the activity. | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
public static Intent newIntentFromCustomActivity(@NonNull Context context, @NonNull Class<? extends FeedNotificationChannelActivity> cls, @NonNull String channelUrl) { | ||
Intent intent = new Intent(context, cls); | ||
intent.putExtra(StringSet.KEY_CHANNEL_URL, channelUrl); | ||
return intent; | ||
} | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setTheme(SendbirdUIKit.isDarkMode() ? R.style.AppTheme_Dark_Sendbird : R.style.AppTheme_Sendbird); | ||
setContentView(R.layout.sb_activity); | ||
|
||
String url = getIntent().getStringExtra(StringSet.KEY_CHANNEL_URL); | ||
if (TextUtils.isEmpty(url)) { | ||
ContextUtils.toastError(this, R.string.sb_text_error_get_channel); | ||
} else { | ||
Fragment fragment = createFragment(); | ||
FragmentManager manager = getSupportFragmentManager(); | ||
manager.popBackStack(); | ||
manager.beginTransaction() | ||
.replace(R.id.sb_fragment_container, fragment) | ||
.commit(); | ||
} | ||
} | ||
|
||
/** | ||
* It will be called when the {@link FeedNotificationChannelActivity} is being created. | ||
* The data contained in Intent is delivered to Fragment's Bundle. | ||
* | ||
* @return {@link com.sendbird.uikit.fragments.FeedNotificationChannelFragment} | ||
* @since 3.5.0 | ||
*/ | ||
@NonNull | ||
protected Fragment createFragment() { | ||
final Bundle args = getIntent() != null && getIntent().getExtras() != null ? getIntent().getExtras() : new Bundle(); | ||
return SendbirdUIKit.getFragmentFactory().newFeedNotificationChannelFragment(args.getString(StringSet.KEY_CHANNEL_URL, ""), args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.