Prepares new menu for general timelines
This commit is contained in:
parent
cc7313ed26
commit
07a1026f76
|
@ -33,6 +33,7 @@ import android.os.Bundle;
|
|||
import android.os.CountDownTimer;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Html;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
|
@ -40,6 +41,7 @@ import android.util.Log;
|
|||
import android.util.Patterns;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -76,6 +78,9 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import fr.gouv.etalab.mastodon.activities.LoginActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.MainActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.MediaActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowAccountActivity;
|
||||
import fr.gouv.etalab.mastodon.activities.ShowConversationActivity;
|
||||
|
@ -235,7 +240,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
|
||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
final String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
|
||||
//Display a preview for accounts that have replied *if enabled and only for home timeline*
|
||||
if( type == RetrieveFeedsAsyncTask.Type.HOME ) {
|
||||
|
@ -859,7 +864,228 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
holder.status_more.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
moreOptionDialog(status, finalConvertView);
|
||||
PopupMenu popup = new PopupMenu(context, holder.status_more);
|
||||
final boolean isOwner = status.getAccount().getId().equals(userId);
|
||||
if( isOwner) {
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_toot_owner, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
AlertDialog.Builder builderInner;
|
||||
String[] stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||
final API.StatusAction doAction;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_remove:
|
||||
builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[0]);
|
||||
doAction = API.StatusAction.UNSTATUS;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
break;
|
||||
case R.id.action_copy:
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
case R.id.action_share:
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return true;
|
||||
case R.id.action_mention:
|
||||
status.setTakingScreenShot(true);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, finalConvertView);
|
||||
status.setTakingScreenShot(false);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Intent intent = new Intent(context, TootActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String fname = "tootmention_" + status.getId() +".jpg";
|
||||
File file = new File (context.getCacheDir() + "/", fname);
|
||||
if (file.exists ()) //noinspection ResultOfMethodCallIgnored
|
||||
file.delete ();
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
b.putString("fileMention", fname);
|
||||
b.putString("tootMention", (status.getReblog() != null)?status.getReblog().getAccount().getAcct():status.getAccount().getAcct());
|
||||
b.putString("urlMention", (status.getReblog() != null)?status.getReblog().getUrl():status.getUrl());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
if(doAction == API.StatusAction.UNSTATUS ){
|
||||
String targetedId = status.getId();
|
||||
new PostActionAsyncTask(context, doAction, targetedId, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}else {
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_toot, popup.getMenu());
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
AlertDialog.Builder builderInner;
|
||||
String[] stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
||||
final API.StatusAction doAction;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_mute:
|
||||
builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[0]);
|
||||
doAction = API.StatusAction.MUTE;
|
||||
break;
|
||||
case R.id.action_block:
|
||||
builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[1]);
|
||||
doAction = API.StatusAction.BLOCK;
|
||||
break;
|
||||
case R.id.action_report:
|
||||
builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[2]);
|
||||
doAction = API.StatusAction.REPORT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
break;
|
||||
case R.id.action_copy:
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
case R.id.action_share:
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return true;
|
||||
case R.id.action_mention:
|
||||
status.setTakingScreenShot(true);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, finalConvertView);
|
||||
status.setTakingScreenShot(false);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Intent intent = new Intent(context, TootActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String fname = "tootmention_" + status.getId() +".jpg";
|
||||
File file = new File (context.getCacheDir() + "/", fname);
|
||||
if (file.exists ()) //noinspection ResultOfMethodCallIgnored
|
||||
file.delete ();
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
b.putString("fileMention", fname);
|
||||
b.putString("tootMention", (status.getReblog() != null)?status.getReblog().getAccount().getAcct():status.getAccount().getAcct());
|
||||
b.putString("urlMention", (status.getReblog() != null)?status.getReblog().getUrl():status.getUrl());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
//Text for report
|
||||
EditText input = null;
|
||||
if( doAction == API.StatusAction.REPORT){
|
||||
input = new EditText(context);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
input.setLayoutParams(lp);
|
||||
builderInner.setView(input);
|
||||
}
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
final EditText finalInput = input;
|
||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
if(doAction == API.StatusAction.REPORT ){
|
||||
String comment = null;
|
||||
if( finalInput.getText() != null)
|
||||
comment = finalInput.getText().toString();
|
||||
new PostActionAsyncTask(context, doAction, status.getId(), status, comment, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}else{
|
||||
String targetedId = status.getAccount().getId();
|
||||
new PostActionAsyncTask(context, doAction, targetedId, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
popup.show();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1330,245 +1556,4 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf
|
|||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* More option for status (report / remove status / Mute / Block)
|
||||
* @param status Status current status
|
||||
*/
|
||||
private void moreOptionDialog(final Status status, final View view){
|
||||
|
||||
|
||||
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||
final boolean isOwner = status.getAccount().getId().equals(userId);
|
||||
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
|
||||
final String[] stringArray, stringArrayConf;
|
||||
final API.StatusAction[] doAction;
|
||||
if( isOwner) {
|
||||
if( status.getVisibility().equals("private") || status.getVisibility().equals("direct")){
|
||||
String[] stringArraytmp = context.getResources().getStringArray(R.array.more_action_owner);
|
||||
List<String> list = new ArrayList<>(Arrays.asList(stringArraytmp));
|
||||
list.remove(3);
|
||||
stringArray = list.toArray(new String[0]);
|
||||
String[] stringArrayConftmp = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||
list = new ArrayList<>(Arrays.asList(stringArrayConftmp));
|
||||
list.remove(3);
|
||||
stringArrayConf = list.toArray(new String[0]);
|
||||
doAction = new API.StatusAction[]{API.StatusAction.UNSTATUS};
|
||||
}else {
|
||||
stringArray = context.getResources().getStringArray(R.array.more_action_owner);
|
||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_owner_confirm);
|
||||
doAction = new API.StatusAction[]{API.StatusAction.UNSTATUS};
|
||||
}
|
||||
|
||||
}else {
|
||||
if( status.getVisibility().equals("private") || status.getVisibility().equals("direct")){
|
||||
String[] stringArraytmp = context.getResources().getStringArray(R.array.more_action);
|
||||
List<String> list = new ArrayList<>(Arrays.asList(stringArraytmp));
|
||||
list.remove(5);
|
||||
stringArray = list.toArray(new String[0]);
|
||||
String[] stringArrayConftmp = context.getResources().getStringArray(R.array.more_action_confirm);
|
||||
list = new ArrayList<>(Arrays.asList(stringArrayConftmp));
|
||||
list.remove(5);
|
||||
stringArrayConf = list.toArray(new String[0]);
|
||||
doAction = new API.StatusAction[]{API.StatusAction.MUTE, API.StatusAction.BLOCK, API.StatusAction.REPORT};
|
||||
}else {
|
||||
stringArray = context.getResources().getStringArray(R.array.more_action);
|
||||
stringArrayConf = context.getResources().getStringArray(R.array.more_action_confirm);
|
||||
doAction = new API.StatusAction[]{API.StatusAction.MUTE, API.StatusAction.BLOCK, API.StatusAction.REPORT};
|
||||
}
|
||||
}
|
||||
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, stringArray);
|
||||
builderSingle.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
AlertDialog.Builder builderInner = new AlertDialog.Builder(context);
|
||||
builderInner.setTitle(stringArrayConf[which]);
|
||||
if( isOwner) {
|
||||
if( which == 0) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else if( which == 1){
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}else if( which == 2) {
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return;
|
||||
}else if( which == 3) {
|
||||
status.setTakingScreenShot(true);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
||||
status.setTakingScreenShot(false);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Intent intent = new Intent(context, TootActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String fname = "tootmention_" + status.getId() +".jpg";
|
||||
File file = new File (context.getCacheDir() + "/", fname);
|
||||
if (file.exists ()) //noinspection ResultOfMethodCallIgnored
|
||||
file.delete ();
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
b.putString("fileMention", fname);
|
||||
b.putString("tootMention", (status.getReblog() != null)?status.getReblog().getAccount().getAcct():status.getAccount().getAcct());
|
||||
b.putString("urlMention", (status.getReblog() != null)?status.getReblog().getUrl():status.getUrl());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
if( which < 2 ){
|
||||
builderInner.setMessage(status.getAccount().getAcct());
|
||||
}else if( which == 2) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));
|
||||
else
|
||||
//noinspection deprecation
|
||||
builderInner.setMessage(Html.fromHtml(status.getContent()));
|
||||
}else if( which == 3 ){
|
||||
ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
String content;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
content = Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY).toString();
|
||||
else
|
||||
//noinspection deprecation
|
||||
content = Html.fromHtml(status.getContent()).toString();
|
||||
ClipData clip = ClipData.newPlainText(Helper.CLIP_BOARD, content);
|
||||
clipboard.setPrimaryClip(clip);
|
||||
Toast.makeText(context,R.string.clipboard,Toast.LENGTH_LONG).show();
|
||||
dialog.dismiss();
|
||||
return;
|
||||
}else if( which == 4 ){
|
||||
Intent sendIntent = new Intent(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.shared_via));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, status.getUrl());
|
||||
sendIntent.setType("text/plain");
|
||||
context.startActivity(Intent.createChooser(sendIntent, context.getString(R.string.share_with)));
|
||||
return;
|
||||
}else if( which == 5 ){
|
||||
status.setTakingScreenShot(true);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
|
||||
|
||||
Handler handler = new Handler();
|
||||
handler.postDelayed(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Bitmap bitmap = Helper.convertTootIntoBitmap(context, view);
|
||||
status.setTakingScreenShot(false);
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
Intent intent = new Intent(context, TootActivity.class);
|
||||
Bundle b = new Bundle();
|
||||
String fname = "tootmention_" + status.getId() +".jpg";
|
||||
File file = new File (context.getCacheDir() + "/", fname);
|
||||
if (file.exists ()) //noinspection ResultOfMethodCallIgnored
|
||||
file.delete ();
|
||||
try {
|
||||
FileOutputStream out = new FileOutputStream(file);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
b.putString("fileMention", fname);
|
||||
b.putString("tootMention", (status.getReblog() != null)?status.getReblog().getAccount().getAcct():status.getAccount().getAcct());
|
||||
b.putString("urlMention", (status.getReblog() != null)?status.getReblog().getUrl():status.getUrl());
|
||||
intent.putExtras(b);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//Text for report
|
||||
EditText input = null;
|
||||
final int position = which;
|
||||
if( doAction[which] == API.StatusAction.REPORT){
|
||||
input = new EditText(context);
|
||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
input.setLayoutParams(lp);
|
||||
builderInner.setView(input);
|
||||
}
|
||||
builderInner.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
final EditText finalInput = input;
|
||||
builderInner.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog,int which) {
|
||||
API.StatusAction statusAction = doAction[position];
|
||||
if(statusAction == API.StatusAction.REPORT || statusAction == API.StatusAction.CREATESTATUS){
|
||||
String comment = null;
|
||||
if( finalInput != null && finalInput.getText() != null)
|
||||
comment = finalInput.getText().toString();
|
||||
new PostActionAsyncTask(context, statusAction, status.getId(), status, comment, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}else{
|
||||
String targetedId;
|
||||
if( doAction[position] == API.StatusAction.FAVOURITE ||
|
||||
doAction[position] == API.StatusAction.UNFAVOURITE ||
|
||||
doAction[position] == API.StatusAction.REBLOG ||
|
||||
doAction[position] == API.StatusAction.UNREBLOG ||
|
||||
doAction[position] == API.StatusAction.UNSTATUS
|
||||
)
|
||||
targetedId = status.getId();
|
||||
else
|
||||
targetedId = status.getAccount().getId();
|
||||
new PostActionAsyncTask(context, statusAction, targetedId, StatusListAdapter.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
builderInner.show();
|
||||
}
|
||||
});
|
||||
builderSingle.create().requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
builderSingle.show();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_mute"
|
||||
android:title="@string/more_action_1"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_block"
|
||||
android:title="@string/more_action_2"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_report"
|
||||
android:title="@string/more_action_3"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_copy"
|
||||
android:title="@string/more_action_4"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/more_action_5"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_mention"
|
||||
android:title="@string/more_action_6"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_remove"
|
||||
android:title="@string/more_action_owner_1"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_copy"
|
||||
android:title="@string/more_action_owner_2"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_share"
|
||||
android:title="@string/more_action_owner_3"
|
||||
app:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_mention"
|
||||
android:title="@string/more_action_owner_4"
|
||||
app:showAsAction="never" />
|
||||
</menu>
|
|
@ -98,28 +98,29 @@
|
|||
<string name="reblog_remove">Toot nicht mehr teilen?</string>
|
||||
<string name="pin_add">Diesen toot anheften?</string>
|
||||
<string name="pin_remove">Diesen toot nicht mehr anheften?</string>
|
||||
<string-array name="more_action">
|
||||
<item>Stummschalten</item>
|
||||
<item>Blockieren</item>
|
||||
<item>Melden</item>
|
||||
<item>Kopieren</item>
|
||||
<item>Teilen</item>
|
||||
<item>Erwähnen</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Entfernen</item>
|
||||
<item>Kopieren</item>
|
||||
<item>Teilen</item>
|
||||
<item>Erwähnen</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
|
||||
<string name="more_action_1">Stummschalten</string>
|
||||
<string name="more_action_2">Blockieren</string>
|
||||
<string name="more_action_3">Melden</string>
|
||||
<string name="more_action_4">Kopieren</string>
|
||||
<string name="more_action_5">Teilen</string>
|
||||
<string name="more_action_6">Erwähnen</string>
|
||||
|
||||
|
||||
<string name="more_action_owner_1">Entfernen</string>
|
||||
<string name="more_action_owner_2">Kopieren</string>
|
||||
<string name="more_action_owner_3">Teilen</string>
|
||||
<string name="more_action_owner_4">Erwähnen</string>
|
||||
|
||||
|
||||
|
||||
<string-array name="more_action_confirm">
|
||||
<item>Nutzer stummschalten?</item>
|
||||
<item>Diesen Nutzer blockieren?</item>
|
||||
<item>Diesen toot melden?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
@ -130,9 +131,6 @@
|
|||
|
||||
<string-array name="more_action_owner_confirm">
|
||||
<item>Entferne diesen toot?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
<plurals name="preview_replies">
|
||||
|
|
|
@ -96,28 +96,26 @@
|
|||
<string name="favourite_remove">Supprimer ce pouet des favoris ?</string>
|
||||
<string name="reblog_add">Partager ce pouet ?</string>
|
||||
<string name="reblog_remove">Supprimer ce pouet des partages ?</string>
|
||||
<string-array name="more_action">
|
||||
<item>Masquer</item>
|
||||
<item>Bloquer</item>
|
||||
<item>Signaler</item>
|
||||
<item>Copier</item>
|
||||
<item>Partager</item>
|
||||
<item>Mentionner</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Supprimer</item>
|
||||
<item>Copier</item>
|
||||
<item>Partager</item>
|
||||
<item>Mentionner</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
<string name="more_action_1">Masquer</string>
|
||||
<string name="more_action_2">Bloquer</string>
|
||||
<string name="more_action_3">Signaler</string>
|
||||
<string name="more_action_4">Copier</string>
|
||||
<string name="more_action_5">Partager</string>
|
||||
<string name="more_action_6">Mentionner</string>
|
||||
|
||||
<string name="more_action_owner_1">Supprimer</string>
|
||||
<string name="more_action_owner_2">Copier</string>
|
||||
<string name="more_action_owner_3">Partager</string>
|
||||
<string name="more_action_owner_4">Mentionner</string>
|
||||
|
||||
|
||||
<string-array name="more_action_confirm">
|
||||
<item>Masquer ce compte ?</item>
|
||||
<item>Bloquer ce compte ?</item>
|
||||
<item>Signaler ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
@ -128,9 +126,6 @@
|
|||
|
||||
<string-array name="more_action_owner_confirm">
|
||||
<item>Supprimer ce pouet ?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
<plurals name="preview_replies">
|
||||
|
|
|
@ -107,33 +107,28 @@
|
|||
<item>Share</item>
|
||||
<item>Mention</item>
|
||||
</string-array>
|
||||
<string-array name="more_action_owner">
|
||||
<item>Remove</item>
|
||||
<item>Copy</item>
|
||||
<item>Share</item>
|
||||
<item>Mention</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
|
||||
<string name="more_action_1">Mute</string>
|
||||
<string name="more_action_2">Block</string>
|
||||
<string name="more_action_3">Report</string>
|
||||
<string name="more_action_4">Copy</string>
|
||||
<string name="more_action_5">Share</string>
|
||||
<string name="more_action_6">Mention</string>
|
||||
<string-array name="more_action_confirm">
|
||||
<item>Mute this account?</item>
|
||||
<item>Block this account?</item>
|
||||
<item>Report this toot?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="more_action_confirm_account">
|
||||
<item>Unmute this account?</item>
|
||||
<item>Unblock this account?</item>
|
||||
</string-array>
|
||||
|
||||
<string name="more_action_owner_1">Remove</string>
|
||||
<string name="more_action_owner_2">Copy</string>
|
||||
<string name="more_action_owner_3">Share</string>
|
||||
<string name="more_action_owner_4">Mention</string>
|
||||
<string-array name="more_action_owner_confirm">
|
||||
<item>Remove this toot?</item>
|
||||
<item>null</item> <!-- Ugly hack to fix confirm box-->
|
||||
<item>null</item>
|
||||
<item>null</item>
|
||||
</string-array>
|
||||
|
||||
<plurals name="preview_replies">
|
||||
|
|
Loading…
Reference in New Issue