mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-31 19:34:55 +01:00
added directmessage fragment
This commit is contained in:
parent
fd63dfb805
commit
d433cad0cd
@ -1,7 +1,6 @@
|
||||
package org.nuclearfog.twidda.adapter;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
@ -49,12 +48,6 @@ public class HomePagerAdapter extends FragmentPagerAdapter {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemPosition(@NonNull Object o) {
|
||||
return POSITION_NONE;
|
||||
}
|
||||
|
||||
|
||||
public void notifySettingsChanged() {
|
||||
for (Fragment fragment : fragments) {
|
||||
if (fragment instanceof OnSettingsChanged)
|
||||
|
@ -51,7 +51,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
}
|
||||
|
||||
|
||||
public void setImageLoad(boolean loadImage) {
|
||||
public void toggleImage(boolean loadImage) {
|
||||
this.loadImage = loadImage;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
RecyclerView rv = (RecyclerView) parent;
|
||||
int position = rv.getChildLayoutPosition(view);
|
||||
if (itemClickListener.get() != null)
|
||||
itemClickListener.get().onAnswer(position);
|
||||
itemClickListener.get().onAnswer(messages[position]);
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.dm_delete).setOnClickListener(new View.OnClickListener() {
|
||||
@ -94,7 +94,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
RecyclerView rv = (RecyclerView) parent;
|
||||
int position = rv.getChildLayoutPosition(view);
|
||||
if (itemClickListener.get() != null)
|
||||
itemClickListener.get().onDelete(position);
|
||||
itemClickListener.get().onDelete(messages[position]);
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.dm_profileImg).setOnClickListener(new View.OnClickListener() {
|
||||
@ -103,7 +103,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
RecyclerView rv = (RecyclerView) parent;
|
||||
int position = rv.getChildLayoutPosition(view);
|
||||
if (itemClickListener.get() != null)
|
||||
itemClickListener.get().onProfileClick(position);
|
||||
itemClickListener.get().onProfileClick(messages[position]);
|
||||
}
|
||||
});
|
||||
return new MessageHolder(view);
|
||||
@ -163,16 +163,6 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
}
|
||||
|
||||
|
||||
public interface OnItemSelected extends OnTagClickListener {
|
||||
|
||||
void onAnswer(int pos);
|
||||
|
||||
void onDelete(int pos);
|
||||
|
||||
void onProfileClick(int pos);
|
||||
}
|
||||
|
||||
|
||||
class MessageHolder extends ViewHolder {
|
||||
final ImageView profile_img;
|
||||
final TextView username;
|
||||
@ -189,4 +179,14 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
||||
message = v.findViewById(R.id.dm_message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public interface OnItemSelected extends OnTagClickListener {
|
||||
|
||||
void onAnswer(Message message);
|
||||
|
||||
void onDelete(Message message);
|
||||
|
||||
void onProfileClick(Message message);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package org.nuclearfog.twidda.adapter;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import org.nuclearfog.twidda.fragment.MessageListFragment;
|
||||
|
||||
public class MessagePagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private final int COUNT = 1;
|
||||
|
||||
private final Fragment[] fragments;
|
||||
|
||||
public MessagePagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
fragments = new Fragment[COUNT];
|
||||
fragments[0] = new MessageListFragment();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragments[position];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return COUNT;
|
||||
}
|
||||
}
|
@ -1,115 +0,0 @@
|
||||
package org.nuclearfog.twidda.backend;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter;
|
||||
import org.nuclearfog.twidda.backend.items.Message;
|
||||
import org.nuclearfog.twidda.database.DatabaseAdapter;
|
||||
import org.nuclearfog.twidda.window.DirectMessage;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import twitter4j.TwitterException;
|
||||
|
||||
public class MessageLoader extends AsyncTask<Long, Void, Void> {
|
||||
|
||||
public enum Mode {
|
||||
GET,
|
||||
LDR,
|
||||
DEL
|
||||
}
|
||||
|
||||
private final Mode mode;
|
||||
private boolean failure = false;
|
||||
|
||||
private WeakReference<DirectMessage> ui;
|
||||
private MessageAdapter mAdapter;
|
||||
private TwitterEngine twitter;
|
||||
private TwitterException err;
|
||||
private List<Message> message;
|
||||
|
||||
|
||||
public MessageLoader(@NonNull DirectMessage context, Mode mode) {
|
||||
ui = new WeakReference<>(context);
|
||||
RecyclerView dm_list = context.findViewById(R.id.messagelist);
|
||||
mAdapter = (MessageAdapter) dm_list.getAdapter();
|
||||
twitter = TwitterEngine.getInstance(context);
|
||||
message = new ArrayList<>();
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
if (ui.get() == null) return;
|
||||
|
||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||
mRefresh.setRefreshing(true);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Long... param) {
|
||||
long messageId = -1;
|
||||
DatabaseAdapter db = new DatabaseAdapter(ui.get());
|
||||
try {
|
||||
switch (mode) {
|
||||
case GET:
|
||||
message = twitter.getMessages();
|
||||
db.storeMessage(message);
|
||||
break;
|
||||
|
||||
case DEL:
|
||||
messageId = param[0];
|
||||
twitter.deleteMessage(messageId);
|
||||
db.deleteDm(messageId);
|
||||
break;
|
||||
}
|
||||
} catch (TwitterException err) {
|
||||
if (err.getErrorCode() == 34) {
|
||||
db.deleteDm(messageId);
|
||||
} else {
|
||||
this.err = err;
|
||||
failure = true;
|
||||
}
|
||||
} catch (Exception err) {
|
||||
if (err.getMessage() != null)
|
||||
Log.e("Direct Message", err.getMessage());
|
||||
failure = true;
|
||||
} finally {
|
||||
message = db.getMessages();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void mode) {
|
||||
if (ui.get() == null) return;
|
||||
|
||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||
mRefresh.setRefreshing(false);
|
||||
|
||||
mAdapter.setData(message);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
if (failure)
|
||||
ErrorHandler.printError(ui.get(), err);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
if (ui.get() == null) return;
|
||||
|
||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||
mRefresh.setRefreshing(false);
|
||||
}
|
||||
}
|
@ -1,36 +1,66 @@
|
||||
package org.nuclearfog.twidda.fragment;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.AsyncTask.Status;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter.OnItemSelected;
|
||||
import org.nuclearfog.twidda.backend.items.Message;
|
||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
import org.nuclearfog.twidda.fragment.backend.MessageLoader;
|
||||
import org.nuclearfog.twidda.window.MessagePopup;
|
||||
import org.nuclearfog.twidda.window.SearchPage;
|
||||
import org.nuclearfog.twidda.window.UserProfile;
|
||||
|
||||
import static android.os.AsyncTask.Status.RUNNING;
|
||||
|
||||
import static org.nuclearfog.twidda.fragment.backend.MessageLoader.Mode.DEL;
|
||||
import static org.nuclearfog.twidda.fragment.backend.MessageLoader.Mode.LOAD;
|
||||
|
||||
|
||||
public class MessageListFragment extends Fragment implements OnRefreshListener {
|
||||
public class MessageListFragment extends Fragment implements OnRefreshListener, OnItemSelected {
|
||||
|
||||
private MessageLoader messageTask;
|
||||
private SwipeRefreshLayout root;
|
||||
private SwipeRefreshLayout reload;
|
||||
private View root;
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle param) {
|
||||
root = new SwipeRefreshLayout(inflater.getContext());
|
||||
RecyclerView list = new RecyclerView(inflater.getContext());
|
||||
root.setOnRefreshListener(this);
|
||||
root.addView(list);
|
||||
return root;
|
||||
View v = inflater.inflate(R.layout.fragment_list, parent, false);
|
||||
RecyclerView list = v.findViewById(R.id.fragment_list);
|
||||
reload = v.findViewById(R.id.fragment_reload);
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(getContext());
|
||||
|
||||
MessageAdapter adapter = new MessageAdapter(this);
|
||||
adapter.setColor(settings.getHighlightColor(), settings.getFontColor());
|
||||
adapter.toggleImage(settings.getImageLoad());
|
||||
reload.setProgressBackgroundColorSchemeColor(settings.getHighlightColor());
|
||||
list.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
list.setHasFixedSize(true);
|
||||
list.setAdapter(adapter);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View v, Bundle param) {
|
||||
root = v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@ -44,7 +74,7 @@ public class MessageListFragment extends Fragment implements OnRefreshListener {
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (messageTask != null && messageTask.getStatus() == RUNNING)
|
||||
if (messageTask != null && messageTask.getStatus() == Status.RUNNING)
|
||||
messageTask.cancel(true);
|
||||
}
|
||||
|
||||
@ -56,4 +86,42 @@ public class MessageListFragment extends Fragment implements OnRefreshListener {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(String tag) {
|
||||
if(!reload.isRefreshing()) {
|
||||
Intent intent = new Intent(getContext(), SearchPage.class);
|
||||
intent.putExtra("search", tag);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAnswer(Message message) {
|
||||
if(!reload.isRefreshing()) {
|
||||
Intent sendDm = new Intent(getContext(), MessagePopup.class);
|
||||
sendDm.putExtra("username", message.getSender().getScreenname());
|
||||
startActivity(sendDm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDelete(Message message) {
|
||||
if(!reload.isRefreshing()) {
|
||||
messageTask = new MessageLoader(root, DEL);
|
||||
messageTask.execute(message.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProfileClick(Message message) {
|
||||
if(!reload.isRefreshing()) {
|
||||
Intent profile = new Intent(getContext(), UserProfile.class);
|
||||
profile.putExtra("userID", message.getSender().getId());
|
||||
profile.putExtra("username", message.getSender().getScreenname());
|
||||
startActivity(profile);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,8 +5,9 @@ import android.support.annotation.NonNull;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter;
|
||||
import org.nuclearfog.twidda.backend.ErrorHandler;
|
||||
import org.nuclearfog.twidda.backend.TwitterEngine;
|
||||
@ -28,7 +29,7 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
}
|
||||
|
||||
private Mode mode;
|
||||
private WeakReference<ViewGroup> ui;
|
||||
private WeakReference<View> ui;
|
||||
private TwitterEngine mTwitter;
|
||||
private TwitterException err;
|
||||
private DatabaseAdapter db;
|
||||
@ -36,9 +37,9 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
private List<Message> messages;
|
||||
|
||||
|
||||
public MessageLoader(@NonNull ViewGroup root, Mode mode) {
|
||||
public MessageLoader(@NonNull View root, Mode mode) {
|
||||
ui = new WeakReference<>(root);
|
||||
RecyclerView rv = (RecyclerView) root.getChildAt(0);
|
||||
RecyclerView rv = root.findViewById(R.id.fragment_list);
|
||||
adapter = (MessageAdapter) rv.getAdapter();
|
||||
mTwitter = TwitterEngine.getInstance(root.getContext());
|
||||
db = new DatabaseAdapter(root.getContext());
|
||||
@ -50,8 +51,7 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
protected void onPreExecute() {
|
||||
if (ui.get() == null)
|
||||
return;
|
||||
|
||||
SwipeRefreshLayout reload = (SwipeRefreshLayout) ui.get();
|
||||
SwipeRefreshLayout reload = ui.get().findViewById(R.id.fragment_reload);
|
||||
reload.setRefreshing(true);
|
||||
}
|
||||
|
||||
@ -92,7 +92,6 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
protected void onPostExecute(Boolean success) {
|
||||
if (ui.get() == null)
|
||||
return;
|
||||
|
||||
if (success) {
|
||||
adapter.setData(messages);
|
||||
adapter.notifyDataSetChanged();
|
||||
@ -100,7 +99,7 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
if (err != null)
|
||||
ErrorHandler.printError(ui.get().getContext(), err);
|
||||
}
|
||||
SwipeRefreshLayout reload = (SwipeRefreshLayout) ui.get();
|
||||
SwipeRefreshLayout reload = ui.get().findViewById(R.id.fragment_reload);
|
||||
reload.setRefreshing(false);
|
||||
}
|
||||
|
||||
@ -109,7 +108,7 @@ public class MessageLoader extends AsyncTask<Long, Void, Boolean> {
|
||||
protected void onCancelled() {
|
||||
if (ui.get() == null)
|
||||
return;
|
||||
SwipeRefreshLayout reload = (SwipeRefreshLayout) ui.get();
|
||||
SwipeRefreshLayout reload = ui.get().findViewById(R.id.fragment_reload);
|
||||
reload.setRefreshing(false);
|
||||
}
|
||||
}
|
@ -1,36 +1,21 @@
|
||||
package org.nuclearfog.twidda.window;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask.Status;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.widget.SwipeRefreshLayout;
|
||||
import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
|
||||
import android.support.v7.app.AlertDialog.Builder;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter;
|
||||
import org.nuclearfog.twidda.adapter.MessageAdapter.OnItemSelected;
|
||||
import org.nuclearfog.twidda.backend.MessageLoader;
|
||||
import org.nuclearfog.twidda.backend.MessageLoader.Mode;
|
||||
import org.nuclearfog.twidda.backend.items.Message;
|
||||
import org.nuclearfog.twidda.adapter.MessagePagerAdapter;
|
||||
import org.nuclearfog.twidda.database.GlobalSettings;
|
||||
|
||||
|
||||
public class DirectMessage extends AppCompatActivity implements OnRefreshListener, OnItemSelected {
|
||||
public class DirectMessage extends AppCompatActivity {
|
||||
|
||||
private MessageLoader messageAsync;
|
||||
private MessageAdapter mAdapter;
|
||||
private SwipeRefreshLayout messageRefresh;
|
||||
private GlobalSettings settings;
|
||||
private RecyclerView dmList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle b) {
|
||||
@ -38,43 +23,19 @@ public class DirectMessage extends AppCompatActivity implements OnRefreshListene
|
||||
setContentView(R.layout.page_dm);
|
||||
|
||||
Toolbar tool = findViewById(R.id.dm_toolbar);
|
||||
View root = findViewById(R.id.dm_layout);
|
||||
ViewPager pager = findViewById(R.id.dm_pager);
|
||||
|
||||
setSupportActionBar(tool);
|
||||
if (getSupportActionBar() != null)
|
||||
getSupportActionBar().setTitle(R.string.directmessage);
|
||||
messageRefresh = findViewById(R.id.dm_reload);
|
||||
dmList = findViewById(R.id.messagelist);
|
||||
View root = findViewById(R.id.dm_layout);
|
||||
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
MessagePagerAdapter adapter = new MessagePagerAdapter(getSupportFragmentManager());
|
||||
pager.setOffscreenPageLimit(1);
|
||||
pager.setAdapter(adapter);
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
messageRefresh.setProgressBackgroundColorSchemeColor(settings.getHighlightColor());
|
||||
|
||||
dmList.setLayoutManager(new LinearLayoutManager(this));
|
||||
dmList.setHasFixedSize(true);
|
||||
messageRefresh.setOnRefreshListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (messageAsync == null) {
|
||||
mAdapter = new MessageAdapter(this);
|
||||
mAdapter.setColor(settings.getFontColor(), settings.getHighlightColor());
|
||||
mAdapter.setImageLoad(settings.getImageLoad());
|
||||
dmList.setAdapter(mAdapter);
|
||||
messageAsync = new MessageLoader(this, Mode.LDR);
|
||||
messageAsync.execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (messageAsync != null && messageAsync.getStatus() == Status.RUNNING) {
|
||||
messageAsync.cancel(true);
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
||||
@ -87,72 +48,10 @@ public class DirectMessage extends AppCompatActivity implements OnRefreshListene
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (messageAsync != null && messageAsync.getStatus() != Status.RUNNING) {
|
||||
if (item.getItemId() == R.id.message) {
|
||||
Intent sendDm = new Intent(this, MessagePopup.class);
|
||||
startActivity(sendDm);
|
||||
}
|
||||
if (item.getItemId() == R.id.message) {
|
||||
Intent sendDm = new Intent(this, MessagePopup.class);
|
||||
startActivity(sendDm);
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAnswer(int position) {
|
||||
if (!messageRefresh.isRefreshing()) {
|
||||
Message message = mAdapter.getData(position);
|
||||
Intent sendDm = new Intent(this, MessagePopup.class);
|
||||
sendDm.putExtra("username", message.getSender().getScreenname());
|
||||
startActivity(sendDm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDelete(int position) {
|
||||
if (!messageRefresh.isRefreshing()) {
|
||||
Message message = mAdapter.getData(position);
|
||||
final long messageId = message.getId();
|
||||
new Builder(this).setMessage(R.string.confirm_delete_dm)
|
||||
.setNegativeButton(R.string.no_confirm, null)
|
||||
.setPositiveButton(R.string.yes_confirm, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
messageAsync = new MessageLoader(DirectMessage.this, Mode.DEL);
|
||||
messageAsync.execute(messageId);
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onProfileClick(int index) {
|
||||
if (!messageRefresh.isRefreshing()) {
|
||||
Message message = mAdapter.getData(index);
|
||||
long userId = message.getSender().getId();
|
||||
String username = message.getSender().getScreenname();
|
||||
Intent user = new Intent(this, UserProfile.class);
|
||||
user.putExtra("userID", userId);
|
||||
user.putExtra("username", username);
|
||||
startActivity(user);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(String tag) {
|
||||
if (!messageRefresh.isRefreshing()) {
|
||||
Intent intent = new Intent(this, SearchPage.class);
|
||||
intent.putExtra("search", tag);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
messageAsync = new MessageLoader(this, Mode.GET);
|
||||
messageAsync.execute();
|
||||
}
|
||||
}
|
@ -41,11 +41,10 @@ public class SearchPage extends AppCompatActivity implements OnTabSelectedListen
|
||||
getSupportActionBar().setDisplayShowTitleEnabled(false);
|
||||
|
||||
Bundle param = getIntent().getExtras();
|
||||
if (param != null) {
|
||||
if (BuildConfig.DEBUG && !param.containsKey("search"))
|
||||
throw new AssertionError();
|
||||
if (param != null && param.containsKey("search")) {
|
||||
search = param.getString("search", "");
|
||||
}
|
||||
} else if (BuildConfig.DEBUG)
|
||||
throw new AssertionError();
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
|
@ -10,16 +10,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bar_wide" />
|
||||
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/dm_reload"
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/dm_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/messagelist"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
@ -68,7 +68,6 @@
|
||||
<string name="confirm_log_lout">ausloggen?</string>
|
||||
<string name="confirm_unfollow">User entfolgen?</string>
|
||||
<string name="confirm_block">user sperren?</string>
|
||||
<string name="confirm_delete_dm">Nachricht löschen?</string>
|
||||
<string name="image_folder_created">Ordner erstellt unter Pictures</string>
|
||||
<string name="image_saved">Bild gespeichert!</string>
|
||||
<string name="tweet_close">Tweetfenster schließen</string>
|
||||
|
@ -73,7 +73,6 @@
|
||||
<string name="yes_confirm">Yes</string>
|
||||
<string name="no_confirm">No</string>
|
||||
<string name="confirm_unfollow">unfollow user?</string>
|
||||
<string name="confirm_delete_dm">delete message?</string>
|
||||
<string name="confirm_block">block user?</string>
|
||||
<string name="confirm_log_lout">log out?</string>
|
||||
<string name="confirm_cancel_tweet">cancel tweet?</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user