Starting two actionbars

This commit is contained in:
stom79 2017-10-24 11:03:36 +02:00
parent 10ad34cfc3
commit b4d0186662
3 changed files with 19 additions and 68 deletions

View File

@ -193,7 +193,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
TextView status_favorite_count;
TextView status_reblog_count;
TextView status_toot_date;
TextView status_reblog_user;
Button status_show_more;
ImageView status_more;
LinearLayout status_document_container;
@ -241,7 +240,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
status_toot_date = (TextView) itemView.findViewById(R.id.status_toot_date);
status_show_more = (Button) itemView.findViewById(R.id.status_show_more);
status_more = (ImageView) itemView.findViewById(R.id.status_more);
status_reblog_user = (TextView) itemView.findViewById(R.id.status_reblog_user);
status_prev1 = (ImageView) itemView.findViewById(R.id.status_prev1);
status_prev2 = (ImageView) itemView.findViewById(R.id.status_prev2);
status_prev3 = (ImageView) itemView.findViewById(R.id.status_prev3);
@ -480,9 +478,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
content = status.getReblog().getContent();
displayName = Helper.shortnameToUnicode(status.getReblog().getAccount().getDisplay_name(), true);
username = status.getReblog().getAccount().getUsername();
holder.status_reblog_user.setText(displayName + " " +String.format("@%s",username));
holder.status_account_displayname.setText(displayName + " " +String.format("@%s",username));
ppurl = status.getReblog().getAccount().getAvatar();
holder.status_reblog_user.setVisibility(View.VISIBLE);
holder.status_account_displayname.setVisibility(View.VISIBLE);
holder.status_account_displayname.setText(context.getResources().getString(R.string.reblog_by, status.getAccount().getUsername()));
name = String.format("%s @%s",displayName,status.getReblog().getAccount().getAcct());
}else {
@ -1014,7 +1012,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
final View finalConvertView = convertView;
final View attached = holder.status_more;
holder.status_more.setOnClickListener(new View.OnClickListener() {
@Override
@ -1098,7 +1095,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
@Override
public void run() {
Bitmap bitmap = Helper.convertTootIntoBitmap(context, finalConvertView);
Bitmap bitmap = Helper.convertTootIntoBitmap(context, holder.status_content_container);
status.setTakingScreenShot(false);
statusListAdapter.notifyDataSetChanged();
Intent intent = new Intent(context, TootActivity.class);

View File

@ -24,12 +24,9 @@ import android.support.v4.view.ViewCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import java.util.ArrayList;
@ -98,7 +95,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
type = (RetrieveFeedsAsyncTask.Type) bundle.get("type");
targetedId = bundle.getString("targetedId", null);
tag = bundle.getString("tag", null);
instanceValue = bundle.getString("hideHeaderValue", null);
hideHeader = bundle.getBoolean("hideHeader", false);
showMediaOnly = bundle.getBoolean("showMediaOnly",false);
showPinned = bundle.getBoolean("showPinned",false);
@ -317,9 +313,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if (status != null && !knownId.contains(status.getId())) {
//Update the id of the last toot retrieved
MainActivity.lastHomeId = status.getId();
int index = lv_status.getFirstVisiblePosition() + 1;
View v = lv_status.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
status.setReplies(new ArrayList<Status>());
statuses.add(0,status);
knownId.add(0,status.getId());
@ -328,7 +321,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if( !status.getAccount().getId().equals(userId))
MainActivity.countNewStatus++;
statusListAdapter.notifyDataSetChanged();
lv_status.setSelectionFromTop(index, top);
if (textviewNoAction.getVisibility() == View.VISIBLE)
textviewNoAction.setVisibility(View.GONE);
}
@ -338,17 +330,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
if (status != null && !knownId.contains(status.getId())) {
status.setReplies(new ArrayList<Status>());
status.setNew(false);
if (lv_status.getFirstVisiblePosition() == 0) {
statuses.add(0, status);
statusListAdapter.notifyDataSetChanged();
} else {
int index = lv_status.getFirstVisiblePosition() + 1;
View v = lv_status.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
statuses.add(0, status);
statusListAdapter.notifyDataSetChanged();
lv_status.setSelectionFromTop(index, top);
}
statuses.add(0, status);
statusListAdapter.notifyDataSetChanged();
knownId.add(0, status.getId());
if (textviewNoAction.getVisibility() == View.VISIBLE)
textviewNoAction.setVisibility(View.GONE);
@ -360,11 +343,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
* Refresh status in list
*/
public void refreshFilter(){
int index = lv_status.getFirstVisiblePosition() + 1;
View v = lv_status.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
statusListAdapter.notifyDataSetChanged();
lv_status.setSelectionFromTop(index, top);
}
@Override
@ -397,11 +376,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
retrieveMissingToots(statuses.get(0).getId());
}
}
int index = lv_status.getFirstVisiblePosition();
View v = lv_status.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
statusListAdapter.notifyDataSetChanged();
lv_status.setSelectionFromTop(index, top);
}
/**
@ -530,41 +505,20 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
@Override
public void onRetrieveMissingFeeds(List<Status> statuses) {
if( statuses != null && statuses.size() > 0) {
if( lv_status.getFirstVisiblePosition() > 1 ) {
int index = lv_status.getFirstVisiblePosition() + statuses.size();
View v = lv_status.getChildAt(0);
int top = (v == null) ? 0 : v.getTop();
for (int i = statuses.size() - 1; i >= 0; i--) {
if (!knownId.contains(statuses.get(i).getId())) {
if (type == RetrieveFeedsAsyncTask.Type.HOME)
statuses.get(i).setNew(true);
knownId.add(0, statuses.get(i).getId());
statuses.get(i).setReplies(new ArrayList<Status>());
this.statuses.add(0, statuses.get(i));
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
if (type == RetrieveFeedsAsyncTask.Type.HOME && !statuses.get(i).getAccount().getId().equals(userId))
MainActivity.countNewStatus++;
}
for (int i = statuses.size() - 1; i >= 0; i--) {
if (!knownId.contains(statuses.get(i).getId())) {
if (type == RetrieveFeedsAsyncTask.Type.HOME)
statuses.get(i).setNew(true);
knownId.add(0,statuses.get(i).getId());
statuses.get(i).setReplies(new ArrayList<Status>());
this.statuses.add(0, statuses.get(i));
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
if (type == RetrieveFeedsAsyncTask.Type.HOME && !statuses.get(i).getAccount().getId().equals(userId))
MainActivity.countNewStatus++;
}
statusListAdapter.notifyDataSetChanged();
lv_status.setSelectionFromTop(index, top);
}else {
for (int i = statuses.size() - 1; i >= 0; i--) {
if (!knownId.contains(statuses.get(i).getId())) {
if (type == RetrieveFeedsAsyncTask.Type.HOME)
statuses.get(i).setNew(true);
knownId.add(0,statuses.get(i).getId());
statuses.get(i).setReplies(new ArrayList<Status>());
this.statuses.add(0, statuses.get(i));
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
if (type == RetrieveFeedsAsyncTask.Type.HOME && !statuses.get(i).getAccount().getId().equals(userId))
MainActivity.countNewStatus++;
}
}
statusListAdapter.notifyDataSetChanged();
}
statusListAdapter.notifyDataSetChanged();
try {
((MainActivity) context).updateHomeCounter();
}catch (Exception ignored){}

View File

@ -32,7 +32,6 @@
<android.support.design.widget.AppBarLayout
android:id="@+id/appBar"
app:layout_scrollFlags="scroll|snap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
@ -40,6 +39,7 @@
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/AppThemeDark_NoActionBar"
@ -112,7 +112,7 @@
>
</RelativeLayout>
<android.support.v7.widget.Toolbar
app:layout_scrollFlags="scroll|snap"
app:layout_scrollFlags="scroll|enterAlways"
android:id="@+id/toolbarBottom"
android:layout_gravity="bottom"
android:layout_width="match_parent"