-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
46 changed files
with
216 additions
and
59 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
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
56 changes: 56 additions & 0 deletions
56
xabber/src/main/java/com/xabber/android/ui/dialog/ChatHistoryClearDialog.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,56 @@ | ||
package com.xabber.android.ui.dialog; | ||
|
||
|
||
import android.app.AlertDialog; | ||
import android.app.Dialog; | ||
import android.app.DialogFragment; | ||
import android.content.DialogInterface; | ||
import android.os.Bundle; | ||
|
||
import com.xabber.android.R; | ||
import com.xabber.android.data.entity.AccountJid; | ||
import com.xabber.android.data.entity.UserJid; | ||
import com.xabber.android.data.message.MessageManager; | ||
import com.xabber.android.data.roster.RosterManager; | ||
|
||
public class ChatHistoryClearDialog extends DialogFragment implements DialogInterface.OnClickListener { | ||
|
||
public static final String ARGUMENT_ACCOUNT = ChatHistoryClearDialog.class.getName() + "ARGUMENT_ACCOUNT"; | ||
public static final String ARGUMENT_USER = ChatHistoryClearDialog.class.getName() + "ARGUMENT_USER"; | ||
|
||
AccountJid account; | ||
UserJid user; | ||
|
||
public static ChatHistoryClearDialog newInstance(AccountJid account, UserJid user) { | ||
ChatHistoryClearDialog fragment = new ChatHistoryClearDialog(); | ||
|
||
Bundle arguments = new Bundle(); | ||
arguments.putParcelable(ARGUMENT_ACCOUNT, account); | ||
arguments.putParcelable(ARGUMENT_USER, user); | ||
fragment.setArguments(arguments); | ||
return fragment; | ||
} | ||
|
||
@Override | ||
public Dialog onCreateDialog(Bundle savedInstanceState) { | ||
Bundle args = getArguments(); | ||
account = args.getParcelable(ARGUMENT_ACCOUNT); | ||
user = args.getParcelable(ARGUMENT_USER); | ||
|
||
String name = RosterManager.getInstance().getBestContact(account, user).getName(); | ||
|
||
return new AlertDialog.Builder(getActivity()) | ||
.setTitle(R.string.clear_history) | ||
.setMessage(getString(R.string.clear_chat_history_dialog_message, name)) | ||
.setPositiveButton(R.string.clear_chat_history_dialog_button, this) | ||
.setNegativeButton(android.R.string.cancel, this).create(); | ||
} | ||
|
||
@Override | ||
public void onClick(DialogInterface dialog, int which) { | ||
if (which == Dialog.BUTTON_POSITIVE) { | ||
MessageManager.getInstance().clearHistory(account, user); | ||
} | ||
} | ||
|
||
} |
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
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
Oops, something went wrong.