Fixes with colors

This commit is contained in:
tom79 2019-11-12 18:51:39 +01:00
parent 7f1084e1f3
commit cd654d8d89
5 changed files with 10 additions and 27 deletions

View File

@ -17,27 +17,20 @@ package app.fedilab.android.drawers;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import androidx.core.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.List;
import app.fedilab.android.helper.Helper;
import app.fedilab.android.R;
import app.fedilab.android.activities.WhoToFollowActivity;
import static app.fedilab.android.helper.Helper.changeDrawableColor;
/**
* Created by Thomas on 10/09/2018.
@ -46,7 +39,6 @@ import static app.fedilab.android.helper.Helper.changeDrawableColor;
public class WhoToFollowAdapter extends BaseAdapter {
private List<String> lists;
private LayoutInflater layoutInflater;
private Context context;
public WhoToFollowAdapter(List<String> lists) {
@ -73,7 +65,7 @@ public class WhoToFollowAdapter extends BaseAdapter {
public View getView(final int position, View convertView, ViewGroup parent) {
context = parent.getContext();
layoutInflater = LayoutInflater.from(context);
LayoutInflater layoutInflater = LayoutInflater.from(context);
String item = lists.get(position);
final ViewHolder holder;
if (convertView == null) {
@ -85,19 +77,7 @@ public class WhoToFollowAdapter extends BaseAdapter {
} else {
holder = (ViewHolder) convertView.getTag();
}
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_LIGHT) {
holder.search_container.setBackgroundResource(R.color.mastodonC3__);
Helper.changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right, R.color.black);
} else if (theme == Helper.THEME_DARK) {
holder.search_container.setBackgroundResource(R.color.mastodonC1_);
Helper.changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right, R.color.dark_text);
} else if (theme == Helper.THEME_BLACK) {
holder.search_container.setBackgroundResource(R.color.black_2);
Helper.changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right, R.color.dark_text);
}
Helper.changeDrawableColor(context, R.drawable.ic_keyboard_arrow_right, R.attr.menuIconColor);
Drawable next = ContextCompat.getDrawable(context, R.drawable.ic_keyboard_arrow_right);
holder.search_title.setText(item);
assert next != null;

View File

@ -28,6 +28,8 @@ import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import app.fedilab.android.client.APIResponse;
@ -78,7 +80,7 @@ public class DisplayHowToFragment extends Fragment implements OnRetrieveHowToInt
@Override
public void onAttach(Context context) {
public void onAttach(@NotNull Context context) {
super.onAttach(context);
this.context = context;
}

View File

@ -29,6 +29,8 @@ import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import org.jetbrains.annotations.NotNull;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -83,7 +85,7 @@ public class WhoToFollowFragment extends Fragment implements OnRetrieveWhoToFoll
}
@Override
public void onAttach(Context context) {
public void onAttach(@NotNull Context context) {
super.onAttach(context);
this.context = context;
}

View File

@ -34,7 +34,6 @@
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:layout_height="wrap_content"
android:orientation="vertical">

View File

@ -25,9 +25,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:divider="@null"></ListView>
android:divider="@null"/>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout
android:id="@+id/loader"
android:visibility="gone"
android:layout_width="match_parent"