bug fix, layout fix

This commit is contained in:
nuclearfog 2020-03-30 14:26:01 +02:00
parent 7fb9080dc8
commit 284ca8a5c9
No known key found for this signature in database
GPG Key ID: ED35E22099354A64
4 changed files with 23 additions and 10 deletions

View File

@ -71,7 +71,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
private Dialog load_dialog_selector, color_dialog_selector; private Dialog load_dialog_selector, color_dialog_selector;
private Spinner locationSpinner; private Spinner locationSpinner;
private LocationAdapter locationAdapter; private LocationAdapter locationAdapter;
private View root; private View root, colorButton1_edge;
private ColorMode mode; private ColorMode mode;
private int color; private int color;
@ -89,6 +89,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
CheckBox toggleAns = findViewById(R.id.toggleAns); CheckBox toggleAns = findViewById(R.id.toggleAns);
Spinner fontSpinner = findViewById(R.id.spinner_font); Spinner fontSpinner = findViewById(R.id.spinner_font);
locationSpinner = findViewById(R.id.spinner_woeid); locationSpinner = findViewById(R.id.spinner_woeid);
colorButton1_edge = findViewById(R.id.color_background_edge);
colorButton1 = findViewById(R.id.color_background); colorButton1 = findViewById(R.id.color_background);
colorButton2 = findViewById(R.id.color_font); colorButton2 = findViewById(R.id.color_font);
colorButton3 = findViewById(R.id.color_popup); colorButton3 = findViewById(R.id.color_popup);
@ -126,6 +127,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
toggleImg.setChecked(settings.getImageLoad()); toggleImg.setChecked(settings.getImageLoad());
toggleAns.setChecked(settings.getAnswerLoad()); toggleAns.setChecked(settings.getAnswerLoad());
root.setBackgroundColor(settings.getBackgroundColor()); root.setBackgroundColor(settings.getBackgroundColor());
colorButton1_edge.setBackgroundColor(settings.getBackgroundColor() ^ INVERTCOLOR);
colorButton1.setBackgroundColor(settings.getBackgroundColor()); colorButton1.setBackgroundColor(settings.getBackgroundColor());
colorButton2.setBackgroundColor(settings.getFontColor()); colorButton2.setBackgroundColor(settings.getFontColor());
colorButton3.setBackgroundColor(settings.getPopupColor()); colorButton3.setBackgroundColor(settings.getPopupColor());
@ -278,6 +280,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
root.setBackgroundColor(color); root.setBackgroundColor(color);
settings.setBackgroundColor(color); settings.setBackgroundColor(color);
colorButton1.setBackgroundColor(color); colorButton1.setBackgroundColor(color);
colorButton1_edge.setBackgroundColor(color ^ INVERTCOLOR);
colorButton1.setTextColor(color ^ INVERTCOLOR); colorButton1.setTextColor(color ^ INVERTCOLOR);
break; break;

View File

@ -10,6 +10,7 @@ import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.nuclearfog.twidda.R; import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.activity.ProfileEditor;
import org.nuclearfog.twidda.backend.items.TwitterUser; import org.nuclearfog.twidda.backend.items.TwitterUser;
import org.nuclearfog.twidda.backend.items.UserHolder; import org.nuclearfog.twidda.backend.items.UserHolder;
import org.nuclearfog.twidda.database.AppDatabase; import org.nuclearfog.twidda.database.AppDatabase;
@ -22,7 +23,7 @@ import static org.nuclearfog.twidda.activity.UserProfile.RETURN_PROFILE_CHANGED;
public class ProfileUpdater extends AsyncTask<Void, Void, TwitterUser> { public class ProfileUpdater extends AsyncTask<Void, Void, TwitterUser> {
private WeakReference<org.nuclearfog.twidda.activity.ProfileEditor> ui; private WeakReference<ProfileEditor> ui;
private WeakReference<Dialog> popup; private WeakReference<Dialog> popup;
private UserHolder userHolder; private UserHolder userHolder;
private TwitterEngine mTwitter; private TwitterEngine mTwitter;
@ -35,7 +36,7 @@ public class ProfileUpdater extends AsyncTask<Void, Void, TwitterUser> {
* *
* @param context Activity context * @param context Activity context
*/ */
public ProfileUpdater(org.nuclearfog.twidda.activity.ProfileEditor context) { public ProfileUpdater(ProfileEditor context) {
ui = new WeakReference<>(context); ui = new WeakReference<>(context);
popup = new WeakReference<>(new Dialog(context)); popup = new WeakReference<>(new Dialog(context));
mTwitter = TwitterEngine.getInstance(context); mTwitter = TwitterEngine.getInstance(context);
@ -49,7 +50,7 @@ public class ProfileUpdater extends AsyncTask<Void, Void, TwitterUser> {
* @param context Activity context * @param context Activity context
* @param userHolder user data * @param userHolder user data
*/ */
public ProfileUpdater(org.nuclearfog.twidda.activity.ProfileEditor context, UserHolder userHolder) { public ProfileUpdater(ProfileEditor context, UserHolder userHolder) {
this(context); this(context);
this.userHolder = userHolder; this.userHolder = userHolder;
} }
@ -104,7 +105,6 @@ public class ProfileUpdater extends AsyncTask<Void, Void, TwitterUser> {
popup.get().dismiss(); popup.get().dismiss();
if (twException != null) { if (twException != null) {
Toast.makeText(ui.get(), twException.getMessageResource(), LENGTH_SHORT).show(); Toast.makeText(ui.get(), twException.getMessageResource(), LENGTH_SHORT).show();
ui.get().finish();
} else if (user != null) { } else if (user != null) {
ui.get().setUser(user); ui.get().setUser(user);
} else if (userHolder != null) { } else if (userHolder != null) {

View File

@ -43,15 +43,24 @@
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="horizontal"> android:orientation="horizontal">
<Button <LinearLayout
android:id="@+id/color_background" android:id="@+id/color_background_edge"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="@dimen/button_settings_color" android:layout_height="@dimen/button_settings_color"
android:layout_margin="@dimen/button_margin" android:layout_margin="@dimen/button_margin"
android:layout_weight="1" android:layout_weight="1"
android:singleLine="true" android:orientation="vertical">
android:text="@string/background" />
<Button
android:id="@+id/color_background"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/button_edge"
android:singleLine="true"
android:text="@string/background" />
</LinearLayout>
<Button <Button
android:id="@+id/color_font" android:id="@+id/color_font"

View File

@ -66,4 +66,5 @@
<dimen name="tweet_button_location">16dp</dimen> <dimen name="tweet_button_location">16dp</dimen>
<dimen name="edittext_background_padding">5dp</dimen> <dimen name="edittext_background_padding">5dp</dimen>
<dimen name="settings_edittext_margin">1dp</dimen> <dimen name="settings_edittext_margin">1dp</dimen>
<dimen name="button_edge">1dp</dimen>
</resources> </resources>