mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Simplified the style.xml to remove items that remain constant across day/night mode.
This commit is contained in:
parent
cc2bb36560
commit
e416a0f48d
13 changed files with 34 additions and 64 deletions
|
|
@ -5,9 +5,11 @@ import android.app.ProgressDialog;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.StringRes;
|
||||
import android.support.v4.app.NavUtils;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.AppCompatDelegate;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
|
|
@ -19,6 +21,8 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import fr.free.nrw.commons.BuildConfig;
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.PageTitle;
|
||||
|
|
@ -34,17 +38,20 @@ import static android.view.inputmethod.EditorInfo.IME_ACTION_DONE;
|
|||
public class LoginActivity extends AccountAuthenticatorActivity {
|
||||
|
||||
public static final String PARAM_USERNAME = "fr.free.nrw.commons.login.username";
|
||||
|
||||
@BindView(R.id.loginButton) Button loginButton;
|
||||
@BindView(R.id.signupButton) Button signupButton;
|
||||
@BindView(R.id.loginUsername) EditText usernameEdit;
|
||||
@BindView(R.id.loginPassword) EditText passwordEdit;
|
||||
@BindView(R.id.loginTwoFactor) EditText twoFactorEdit;
|
||||
@BindView(R.id.error_message_container) ViewGroup errorMessageContainer;
|
||||
@BindView(R.id.error_message) TextView errorMessage;
|
||||
|
||||
private CommonsApplication app;
|
||||
ProgressDialog progressDialog;
|
||||
private AppCompatDelegate delegate;
|
||||
private SharedPreferences prefs = null;
|
||||
private Button loginButton;
|
||||
private EditText usernameEdit;
|
||||
private EditText passwordEdit;
|
||||
private EditText twoFactorEdit;
|
||||
private LoginTextWatcher textWatcher = new LoginTextWatcher();
|
||||
private CommonsApplication app;
|
||||
private ViewGroup errorMessageContainer;
|
||||
private TextView errorMessage;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
|
|
@ -57,13 +64,7 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
loginButton = findViewById(R.id.loginButton);
|
||||
Button signupButton = findViewById(R.id.signupButton);
|
||||
usernameEdit = findViewById(R.id.loginUsername);
|
||||
passwordEdit = findViewById(R.id.loginPassword);
|
||||
twoFactorEdit = findViewById(R.id.loginTwoFactor);
|
||||
errorMessageContainer = findViewById(R.id.error_message_container);
|
||||
errorMessage = findViewById(R.id.error_message);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
prefs = getSharedPreferences("fr.free.nrw.commons", MODE_PRIVATE);
|
||||
|
||||
|
|
@ -160,12 +161,12 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
}
|
||||
|
||||
public void showMessageAndCancelDialog(@StringRes int resId) {
|
||||
showMessage(resId);
|
||||
showMessage(resId, R.color.secondaryDarkColor);
|
||||
progressDialog.cancel();
|
||||
}
|
||||
|
||||
public void showSuccessAndDismissDialog() {
|
||||
showMessage(R.string.login_success);
|
||||
showMessage(R.string.login_success, R.color.primaryDarkColor);
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
|
|
@ -223,8 +224,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
return new PageTitle(username).getText();
|
||||
}
|
||||
|
||||
private void showMessage(@StringRes int resId) {
|
||||
private void showMessage(@StringRes int resId, @ColorRes int colorResId) {
|
||||
errorMessage.setText(getString(resId));
|
||||
errorMessage.setTextColor(ContextCompat.getColor(this, colorResId));
|
||||
errorMessageContainer.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
|
@ -246,12 +248,9 @@ public class LoginActivity extends AccountAuthenticatorActivity {
|
|||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
if (usernameEdit.getText().length() != 0 && passwordEdit.getText().length() != 0 &&
|
||||
(BuildConfig.DEBUG || twoFactorEdit.getText().length() != 0 || twoFactorEdit.getVisibility() != View.VISIBLE)) {
|
||||
loginButton.setEnabled(true);
|
||||
} else {
|
||||
loginButton.setEnabled(false);
|
||||
}
|
||||
boolean enabled = usernameEdit.getText().length() != 0 && passwordEdit.getText().length() != 0 &&
|
||||
(BuildConfig.DEBUG || twoFactorEdit.getText().length() != 0 || twoFactorEdit.getVisibility() != View.VISIBLE);
|
||||
loginButton.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:background="@color/primaryLightColor"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
|
@ -59,7 +58,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/primaryDarkColor"
|
||||
android:textColor="@color/secondaryDarkColor"
|
||||
tools:text="Check your password, something doesnt look right" />
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:background="@color/primaryLightColor"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
|
@ -59,7 +58,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/primaryDarkColor"
|
||||
android:textColor="@color/secondaryDarkColor"
|
||||
tools:text="Check your password, something doesnt look right" />
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/title"
|
||||
android:background="@color/primaryLightColor"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
|
|
@ -59,7 +58,7 @@
|
|||
android:layout_marginStart="16dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:textColor="@color/primaryDarkColor"
|
||||
android:textColor="@color/secondaryDarkColor"
|
||||
tools:text="Check your password, something doesnt look right" />
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,21 +2,18 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/commonsAppBlue"
|
||||
>
|
||||
android:background="@color/primaryColor">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/welcomePager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fadingEdge="none"
|
||||
/>
|
||||
android:fadingEdge="none" />
|
||||
|
||||
<com.viewpagerindicator.CirclePageIndicator
|
||||
android:id="@+id/welcomePagerIndicator"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
/>
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
</FrameLayout>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/menu_upload_single"
|
||||
android:title="@string/menu_upload_single"
|
||||
android:icon="?attr/iconSend"
|
||||
android:icon="@drawable/ic_send_white_24dp"
|
||||
android:enabled="false"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@
|
|||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item android:id="@+id/menu_save_categories"
|
||||
android:title="@string/menu_save_categories"
|
||||
android:icon="?attr/iconSave"
|
||||
android:icon="@drawable/ic_save_white_24dp"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
||||
|
|
@ -3,12 +3,12 @@
|
|||
<item android:id="@+id/menu_from_camera"
|
||||
android:title="@string/menu_from_camera"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="?attr/iconCamera"
|
||||
android:icon="@drawable/ic_photo_camera_white_24dp"
|
||||
/>
|
||||
<item android:id="@+id/menu_from_gallery"
|
||||
android:title="@string/menu_from_gallery"
|
||||
app:showAsAction="ifRoom|withText"
|
||||
android:icon="?attr/iconPhoto"
|
||||
android:icon="@drawable/ic_photo_white_24dp"
|
||||
/>
|
||||
<!--<item android:id="@+id/menu_nearby"-->
|
||||
<!--android:title="@string/menu_nearby"-->
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<item
|
||||
android:id="@+id/menu_retry_current_image"
|
||||
android:enabled="false"
|
||||
android:icon="?attr/iconUndo"
|
||||
android:icon="@drawable/ic_undo_white_24dp"
|
||||
android:title="@string/menu_retry_upload"
|
||||
android:visible="false"
|
||||
app:showAsAction="ifRoom|withText" />
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
<item android:id="@+id/menu_upload_multiple"
|
||||
android:title="@string/share_upload_button"
|
||||
app:showAsAction="always|withText"
|
||||
android:icon="?attr/iconSend"
|
||||
android:icon="@drawable/ic_send_white_24dp"
|
||||
/>
|
||||
</menu>
|
||||
|
|
@ -2,17 +2,11 @@
|
|||
<resources>
|
||||
<attr name="mainBackground" format="reference"/>
|
||||
<attr name="semitransparentText" format="reference"/>
|
||||
<attr name="commonsAppBlue" format="reference"/>
|
||||
<attr name="subBackground" format="reference"/>
|
||||
<attr name="fragmentCategorisationBackground" format="reference"/>
|
||||
<attr name="buttonBackground" format="reference"/>
|
||||
<attr name="uploadOverlayBackground" format="reference"/>
|
||||
<attr name="spinnerTheme" format="reference"/>
|
||||
<attr name="iconSend" format="reference"/>
|
||||
<attr name="iconSave" format="reference"/>
|
||||
<attr name="iconCamera" format="reference"/>
|
||||
<attr name="iconPhoto" format="reference"/>
|
||||
<attr name="iconUndo" format="reference"/>
|
||||
|
||||
<declare-styleable name="CompatTextView">
|
||||
<attr name="drawablePadding" format="dimension"/>
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@
|
|||
<color name="item_white_background">#ffffffff</color>
|
||||
<color name="commons_app_blue_dark">#33FFFFFF</color>
|
||||
<color name="commons_app_blue_light">#33FFFFFF</color>
|
||||
<color name="activity_welcome_background_dark">#0c609c</color>
|
||||
<color name="activity_welcome_background_light">#0c609c</color>
|
||||
<color name="action_bar_blue">#0c609c</color>
|
||||
<color name="status_bar_blue">#08436d</color>
|
||||
<color name="sub_background_dark">#20ffffff</color>
|
||||
<color name="sub_background_light">#20ffffff</color>
|
||||
|
|
|
|||
|
|
@ -8,38 +8,24 @@
|
|||
<item name="colorButtonNormal">@color/primaryColor</item>
|
||||
|
||||
<item name="semitransparentText">@color/commons_app_blue_dark</item>
|
||||
<item name="commonsAppBlue">@color/activity_welcome_background_dark</item>
|
||||
<item name="subBackground">@color/sub_background_dark</item>
|
||||
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_dark</item>
|
||||
<item name="buttonBackground">@color/button_background_dark</item>
|
||||
<item name="uploadOverlayBackground">@color/upload_overlay_background_dark</item>
|
||||
<item name="iconSend">@drawable/ic_send_white_24dp</item>
|
||||
<item name="iconSave">@drawable/ic_save_white_24dp</item>
|
||||
<item name="iconCamera">@drawable/ic_photo_camera_white_24dp</item>
|
||||
<item name="iconPhoto">@drawable/ic_photo_white_24dp</item>
|
||||
<item name="iconUndo">@drawable/ic_undo_white_24dp</item>
|
||||
<item name="spinnerTheme">@style/DarkSpinnerTheme</item>
|
||||
</style>
|
||||
|
||||
<style name="LightAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="mainBackground">@color/main_background_light</item>
|
||||
<item name="colorPrimary">@color/primaryColor</item>
|
||||
<item name="colorPrimaryDark">@color/primaryDarkColor</item>
|
||||
<item name="colorAccent">@color/primaryColor</item>
|
||||
<item name="colorButtonNormal">@color/primaryColor</item>
|
||||
|
||||
<item name="semitransparentText">@color/commons_app_blue_light</item>
|
||||
<item name="commonsAppBlue">@color/activity_welcome_background_light</item>
|
||||
<item name="subBackground">@color/sub_background_light</item>
|
||||
<item name="fragmentCategorisationBackground">@color/fragment_categorisation_background_light</item>
|
||||
<item name="buttonBackground">@color/button_background_light</item>
|
||||
<item name="uploadOverlayBackground">@color/upload_overlay_background_light</item>
|
||||
<item name="iconSend">@drawable/ic_send_white_24dp</item>
|
||||
<item name="iconSave">@drawable/ic_save_white_24dp</item>
|
||||
<item name="iconCamera">@drawable/ic_photo_camera_white_24dp</item>
|
||||
<item name="iconPhoto">@drawable/ic_photo_white_24dp</item>
|
||||
<item name="iconUndo">@drawable/ic_undo_white_24dp</item>
|
||||
|
||||
<item name="spinnerTheme">@style/LightSpinnerTheme</item>
|
||||
</style>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue