mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-07 23:58:44 +01:00
added ConstraintLayout to settings page, layout fix
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
27a6dc9563
commit
036d26cd8c
@ -35,6 +35,7 @@ import androidx.appcompat.widget.Toolbar;
|
||||
import com.flask.colorpicker.ColorPickerView;
|
||||
import com.flask.colorpicker.OnColorChangedListener;
|
||||
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
||||
import com.kyleduo.switchbutton.SwitchButton;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.adapter.FontAdapter;
|
||||
@ -70,9 +71,9 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
private FontAdapter fontAdapter;
|
||||
|
||||
private Dialog connectDialog, databaseDialog, logoutDialog, color_dialog_selector, appInfo, license;
|
||||
private View root, layout_hq_image, layout_key, layout_proxy, layout_auth_en, layout_auth;
|
||||
private View root, hqImageText, enableAuthTxt;
|
||||
private EditText proxyAddr, proxyPort, proxyUser, proxyPass, api_key1, api_key2;
|
||||
private CompoundButton enableProxy, enableAuth, hqImage, enableAPI;
|
||||
private SwitchButton enableProxy, enableAuth, hqImage, enableAPI;
|
||||
private Spinner locationSpinner;
|
||||
private TextView list_size;
|
||||
private Button[] colorButtons = new Button[ColorMode.values().length];
|
||||
@ -108,10 +109,10 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
Toolbar toolbar = findViewById(R.id.toolbar_setting);
|
||||
View trend_card = findViewById(R.id.settings_trend_card);
|
||||
View user_card = findViewById(R.id.settings_data_card);
|
||||
CompoundButton toggleImg = findViewById(R.id.toggleImg);
|
||||
CompoundButton toggleAns = findViewById(R.id.toggleAns);
|
||||
CompoundButton toolbarOverlap = findViewById(R.id.settings_toolbar_ov);
|
||||
CompoundButton enablePreview = findViewById(R.id.settings_enable_prev);
|
||||
SwitchButton toggleImg = findViewById(R.id.toggleImg);
|
||||
SwitchButton toggleAns = findViewById(R.id.toggleAns);
|
||||
SwitchButton toolbarOverlap = findViewById(R.id.settings_toolbar_ov);
|
||||
SwitchButton enablePreview = findViewById(R.id.settings_enable_prev);
|
||||
SeekBar listSizeSelector = findViewById(R.id.settings_list_seek);
|
||||
Spinner fontSpinner = findViewById(R.id.spinner_font);
|
||||
enableProxy = findViewById(R.id.settings_enable_proxy);
|
||||
@ -119,6 +120,8 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
hqImage = findViewById(R.id.settings_image_hq);
|
||||
enableAPI = findViewById(R.id.settings_set_custom_keys);
|
||||
locationSpinner = findViewById(R.id.spinner_woeid);
|
||||
hqImageText = findViewById(R.id.settings_image_hq_descr);
|
||||
enableAuthTxt = findViewById(R.id.settings_enable_auth_descr);
|
||||
colorButtons[ColorMode.BACKGROUND.INDEX] = findViewById(R.id.color_background);
|
||||
colorButtons[ColorMode.FONTCOLOR.INDEX] = findViewById(R.id.color_font);
|
||||
colorButtons[ColorMode.POPUPCOLOR.INDEX] = findViewById(R.id.color_popup);
|
||||
@ -136,11 +139,6 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
api_key1 = findViewById(R.id.settings_custom_key1);
|
||||
api_key2 = findViewById(R.id.settings_custom_key2);
|
||||
list_size = findViewById(R.id.settings_list_size);
|
||||
layout_proxy = findViewById(R.id.settings_layout_proxy);
|
||||
layout_hq_image = findViewById(R.id.settings_image_hq_layout);
|
||||
layout_auth_en = findViewById(R.id.settings_layout_auth_enable);
|
||||
layout_auth = findViewById(R.id.settings_layout_proxy_auth);
|
||||
layout_key = findViewById(R.id.settings_layout_key);
|
||||
root = findViewById(R.id.settings_layout);
|
||||
|
||||
toolbar.setTitle(R.string.title_settings);
|
||||
@ -159,28 +157,45 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
AppStyles.setTheme(settings, root);
|
||||
AppStyles.setOverflowIcon(toolbar, settings.getIconColor());
|
||||
|
||||
connectDialog = new ConfirmDialog(this, DialogType.WRONG_PROXY, this);
|
||||
connectDialog = new ConfirmDialog(this, DialogType.WRONG_PROXY, this);
|
||||
databaseDialog = new ConfirmDialog(this, DialogType.DEL_DATABASE, this);
|
||||
logoutDialog = new ConfirmDialog(this, DialogType.APP_LOG_OUT, this);
|
||||
appInfo = new InfoDialog(this);
|
||||
license = new LicenseDialog(this);
|
||||
|
||||
if (!settings.isLoggedIn()) {
|
||||
trend_card.setVisibility(GONE);
|
||||
user_card.setVisibility(GONE);
|
||||
}
|
||||
if (!settings.isProxyEnabled()) {
|
||||
layout_proxy.setVisibility(GONE);
|
||||
layout_auth_en.setVisibility(GONE);
|
||||
proxyAddr.setVisibility(GONE);
|
||||
proxyPort.setVisibility(GONE);
|
||||
proxyUser.setVisibility(GONE);
|
||||
proxyPass.setVisibility(GONE);
|
||||
enableAuth.setVisibility(GONE);
|
||||
enableAuthTxt.setVisibility(GONE);
|
||||
} else if (!settings.isProxyAuthSet()) {
|
||||
proxyUser.setVisibility(GONE);
|
||||
proxyPass.setVisibility(GONE);
|
||||
}
|
||||
if (!settings.imagesEnabled()) {
|
||||
layout_hq_image.setVisibility(GONE);
|
||||
}
|
||||
if (!settings.isProxyAuthSet()) {
|
||||
layout_auth.setVisibility(GONE);
|
||||
hqImageText.setVisibility(GONE);
|
||||
hqImage.setVisibility(GONE);
|
||||
}
|
||||
if (!settings.isCustomApiSet()) {
|
||||
layout_key.setVisibility(GONE);
|
||||
api_key1.setVisibility(GONE);
|
||||
api_key2.setVisibility(GONE);
|
||||
}
|
||||
toggleImg.setChecked(settings.imagesEnabled());
|
||||
toggleAns.setChecked(settings.replyLoadingEnabled());
|
||||
enableAPI.setChecked(settings.isCustomApiSet());
|
||||
enablePreview.setChecked(settings.linkPreviewEnabled());
|
||||
toolbarOverlap.setChecked(settings.toolbarOverlapEnabled());
|
||||
toggleImg.setCheckedImmediately(settings.imagesEnabled());
|
||||
toggleAns.setCheckedImmediately(settings.replyLoadingEnabled());
|
||||
enablePreview.setCheckedImmediately(settings.linkPreviewEnabled());
|
||||
toolbarOverlap.setCheckedImmediately(settings.toolbarOverlapEnabled());
|
||||
enableAPI.setCheckedImmediately(settings.isCustomApiSet());
|
||||
enableProxy.setCheckedImmediately(settings.isProxyEnabled());
|
||||
enableAuth.setCheckedImmediately(settings.isProxyAuthSet());
|
||||
hqImage.setCheckedImmediately(settings.imagesEnabled());
|
||||
hqImage.setCheckedImmediately(settings.getImageQuality());
|
||||
proxyAddr.setText(settings.getProxyHost());
|
||||
proxyPort.setText(settings.getProxyPort());
|
||||
proxyUser.setText(settings.getProxyUser());
|
||||
@ -189,19 +204,8 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
api_key2.setText(settings.getConsumerSecret());
|
||||
list_size.setText(Integer.toString(settings.getListSize()));
|
||||
listSizeSelector.setProgress(settings.getListSize() / 10 - 1);
|
||||
enableProxy.setChecked(settings.isProxyEnabled());
|
||||
enableAuth.setChecked(settings.isProxyAuthSet());
|
||||
hqImage.setEnabled(settings.imagesEnabled());
|
||||
hqImage.setChecked(settings.getImageQuality());
|
||||
setButtonColors();
|
||||
|
||||
connectDialog = new ConfirmDialog(this, DialogType.WRONG_PROXY, this);
|
||||
connectDialog = new ConfirmDialog(this, DialogType.WRONG_PROXY, this);
|
||||
databaseDialog = new ConfirmDialog(this, DialogType.DEL_DATABASE, this);
|
||||
logoutDialog = new ConfirmDialog(this, DialogType.APP_LOG_OUT, this);
|
||||
appInfo = new InfoDialog(this);
|
||||
license = new LicenseDialog(this);
|
||||
|
||||
for (Button button : colorButtons)
|
||||
button.setOnClickListener(this);
|
||||
logout.setOnClickListener(this);
|
||||
@ -456,11 +460,12 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
// toggle image loading
|
||||
if (c.getId() == R.id.toggleImg) {
|
||||
settings.setImageLoad(checked);
|
||||
hqImage.setEnabled(checked);
|
||||
if (checked) {
|
||||
layout_hq_image.setVisibility(VISIBLE);
|
||||
hqImageText.setVisibility(VISIBLE);
|
||||
hqImage.setVisibility(VISIBLE);
|
||||
} else {
|
||||
layout_hq_image.setVisibility(GONE);
|
||||
hqImageText.setVisibility(GONE);
|
||||
hqImage.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
// toggle automatic answer load
|
||||
@ -482,28 +487,36 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
||||
// enable proxy settings
|
||||
else if (c.getId() == R.id.settings_enable_proxy) {
|
||||
if (checked) {
|
||||
layout_proxy.setVisibility(VISIBLE);
|
||||
layout_auth_en.setVisibility(VISIBLE);
|
||||
proxyAddr.setVisibility(VISIBLE);
|
||||
proxyPort.setVisibility(VISIBLE);
|
||||
enableAuth.setVisibility(VISIBLE);
|
||||
enableAuthTxt.setVisibility(VISIBLE);
|
||||
} else {
|
||||
layout_proxy.setVisibility(GONE);
|
||||
layout_auth_en.setVisibility(GONE);
|
||||
proxyAddr.setVisibility(GONE);
|
||||
proxyPort.setVisibility(GONE);
|
||||
enableAuthTxt.setVisibility(GONE);
|
||||
enableAuth.setVisibility(GONE);
|
||||
enableAuth.setChecked(false);
|
||||
}
|
||||
}
|
||||
//enable proxy authentication
|
||||
else if (c.getId() == R.id.settings_enable_auth) {
|
||||
if (checked) {
|
||||
layout_auth.setVisibility(VISIBLE);
|
||||
proxyUser.setVisibility(VISIBLE);
|
||||
proxyPass.setVisibility(VISIBLE);
|
||||
} else {
|
||||
layout_auth.setVisibility(GONE);
|
||||
proxyUser.setVisibility(GONE);
|
||||
proxyPass.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
// enable custom API setup
|
||||
else if (c.getId() == R.id.settings_set_custom_keys) {
|
||||
if (checked) {
|
||||
layout_key.setVisibility(VISIBLE);
|
||||
api_key1.setVisibility(VISIBLE);
|
||||
api_key2.setVisibility(VISIBLE);
|
||||
} else {
|
||||
layout_key.setVisibility(GONE);
|
||||
api_key1.setVisibility(GONE);
|
||||
api_key2.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="@dimen/infopopup_text_padding"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="@dimen/settings_info_appname_font" />
|
||||
android:textSize="@dimen/infopopup_appname_font" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
|
@ -18,7 +18,7 @@
|
||||
android:textSize="@dimen/confirm_title_fontsize"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/confirm_message"
|
||||
app:layout_constraintBottom_toTopOf="@id/confirm_message"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<TextView
|
||||
@ -30,7 +30,7 @@
|
||||
android:maxLines="@integer/confirm_message_max_ines"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/confirm_title"
|
||||
app:layout_constraintTop_toBottomOf="@id/confirm_title"
|
||||
app:layout_constraintBottom_toTopOf="@id/confirm_barrier"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
@ -45,20 +45,20 @@
|
||||
android:id="@+id/confirm_no"
|
||||
style="@style/FeedbackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/settings_button_height"
|
||||
android:layout_height="@dimen/confirm_button_height"
|
||||
android:text="@android:string/cancel"
|
||||
android:layout_margin="@dimen/confirm_button_margin"
|
||||
android:textSize="@dimen/confirm_button_fontsize"
|
||||
android:padding="@dimen/confirm_button_padding"
|
||||
android:singleLine="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/confirm_yes" />
|
||||
app:layout_constraintEnd_toStartOf="@id/confirm_yes" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/confirm_yes"
|
||||
style="@style/FeedbackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/settings_button_height"
|
||||
android:layout_height="@dimen/confirm_button_height"
|
||||
android:text="@android:string/ok"
|
||||
android:layout_margin="@dimen/confirm_button_margin"
|
||||
android:textSize="@dimen/confirm_button_fontsize"
|
||||
|
@ -10,13 +10,14 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_banner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:contentDescription="@string/profile_banner"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintDimensionRatio="3.0"
|
||||
app:layout_constraintStart_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/edit_add_banner"
|
||||
@ -27,37 +28,38 @@
|
||||
android:paddingRight="@dimen/editprofile_button_padding"
|
||||
android:text="@string/editprofile_add_banner"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/edit_banner"
|
||||
app:layout_constraintEnd_toEndOf="@+id/edit_banner"
|
||||
app:layout_constraintStart_toStartOf="@+id/edit_banner"
|
||||
app:layout_constraintTop_toBottomOf="@+id/editprofile_toolbar_background" />
|
||||
app:layout_constraintStart_toStartOf="@id/edit_banner"
|
||||
app:layout_constraintTop_toBottomOf="@id/editprofile_toolbar_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_banner"
|
||||
app:layout_constraintEnd_toEndOf="@id/edit_banner" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_change_banner"
|
||||
android:layout_width="@dimen/editprofile_add_btn_size"
|
||||
android:layout_height="@dimen/editprofile_add_btn_size"
|
||||
android:contentDescription="@string/descr_add_profile_image"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/edit_add_banner"
|
||||
app:layout_constraintEnd_toEndOf="@+id/edit_add_banner"
|
||||
app:layout_constraintStart_toStartOf="@+id/edit_add_banner"
|
||||
app:layout_constraintTop_toTopOf="@+id/edit_add_banner" />
|
||||
app:layout_constraintStart_toStartOf="@id/edit_add_banner"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_add_banner"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_add_banner"
|
||||
app:layout_constraintEnd_toEndOf="@id/edit_add_banner" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/editprofile_toolbar_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/editprofile_toolbar_height"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/edit_banner"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_banner"
|
||||
app:layout_constraintBottom_toBottomOf="@id/editprofile_toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/editprofile_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/editprofile_toolbar_height"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_pb"
|
||||
@ -67,29 +69,29 @@
|
||||
android:layout_marginLeft="@dimen/editprofile_profile_image_left_margin"
|
||||
android:contentDescription="@string/image_preview"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/edit_banner"
|
||||
app:layout_constraintStart_toStartOf="@+id/edit_banner"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_banner" />
|
||||
app:layout_constraintStart_toStartOf="@id/edit_banner"
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_banner"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_banner" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/profile_change_image_btn"
|
||||
android:layout_width="@dimen/editprofile_add_btn_size"
|
||||
android:layout_height="@dimen/editprofile_add_btn_size"
|
||||
android:contentDescription="@string/descr_add_profile_image"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/edit_pb"
|
||||
app:layout_constraintEnd_toEndOf="@+id/edit_pb"
|
||||
app:layout_constraintStart_toStartOf="@+id/edit_pb"
|
||||
app:layout_constraintTop_toTopOf="@+id/edit_pb" />
|
||||
app:layout_constraintStart_toStartOf="@id/edit_pb"
|
||||
app:layout_constraintTop_toTopOf="@id/edit_pb"
|
||||
app:layout_constraintBottom_toBottomOf="@id/edit_pb"
|
||||
app:layout_constraintEnd_toEndOf="@id/edit_pb" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/editprofile_scroll"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="@dimen/editprofile_scrollview_margin"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/edit_pb">
|
||||
app:layout_constraintTop_toBottomOf="@id/edit_pb"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,15 +8,15 @@
|
||||
|
||||
<!--dimens of page_settings.xml-->
|
||||
<dimen name="settings_toolbar_height">@dimen/toolbar_height</dimen>
|
||||
<dimen name="settings_textsize_small">12sp</dimen>
|
||||
<dimen name="settings_info_appname_font">18sp</dimen>
|
||||
<dimen name="settings_layout_padding">16dp</dimen>
|
||||
<dimen name="settings_textsize">20sp</dimen>
|
||||
<dimen name="settings_button_height">30sp</dimen>
|
||||
<dimen name="settings_color_button_height">42sp</dimen>
|
||||
<dimen name="settings_color_button_margin">2dp</dimen>
|
||||
<dimen name="settings_color_button_stroke_width">2dp</dimen>
|
||||
<dimen name="settings_color_button_corner_radius">4dp</dimen>
|
||||
<dimen name="settings_cardview_padding">10dp</dimen>
|
||||
<dimen name="settings_textsize">20sp</dimen>
|
||||
<dimen name="settings_textsize_small">12sp</dimen>
|
||||
|
||||
<dimen name="settings_button_height">30sp</dimen>
|
||||
<dimen name="settings_button_margin">5dp</dimen>
|
||||
<dimen name="settings_switch_margin">10dp</dimen>
|
||||
<dimen name="settings_spinner_margin">10dp</dimen>
|
||||
@ -184,6 +184,7 @@
|
||||
|
||||
<!--dimens of dialog_app_info.xml-->
|
||||
<dimen name="infopopup_text_padding">5dp</dimen>
|
||||
<dimen name="infopopup_appname_font">18sp</dimen>
|
||||
|
||||
<!--dimens of dialog_license.xml-->
|
||||
<dimen name="license_textsize">8sp</dimen>
|
||||
@ -195,6 +196,7 @@
|
||||
<dimen name="confirm_button_fontsize">14sp</dimen>
|
||||
<dimen name="confirm_message_fontsize">18sp</dimen>
|
||||
<dimen name="confirm_title_fontsize">22sp</dimen>
|
||||
<dimen name="confirm_button_height">30sp</dimen>
|
||||
<integer name="confirm_message_max_ines">8</integer>
|
||||
|
||||
<!--dimens of dialog_userlist.xml-->
|
||||
|
Loading…
x
Reference in New Issue
Block a user