Commit 952e01d6 authored by Donald's avatar Donald

clean switch colors

parent f85cfd7a
......@@ -1007,9 +1007,7 @@ public class MainActivity extends SharedMediaActivity {
themeRadioButton((RadioButton) dialogLayout.findViewById(R.id.radio_jpeg));
themeRadioButton((RadioButton) dialogLayout.findViewById(R.id.radio_png));
themeRadioButton((RadioButton) dialogLayout.findViewById(R.id.radio_webp));
setSwitchColor(swVertical, getAccentColor());
setSwitchColor(swSaveHere, getAccentColor());
setSwitchColor(getAccentColor(), swSaveHere, swVertical);
//endregion
seekQuality.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
......@@ -1034,7 +1032,7 @@ public class MainActivity extends SharedMediaActivity {
@Override
public void onClick(View v) {
swVertical.setChecked(!swVertical.isChecked());
setSwitchColor(swVertical, getAccentColor());
setSwitchColor(getAccentColor(), swVertical);
}
});
......@@ -1043,7 +1041,7 @@ public class MainActivity extends SharedMediaActivity {
@Override
public void onClick(View v) {
swSaveHere.setChecked(!swSaveHere.isChecked());
setSwitchColor(swSaveHere, getAccentColor());
setSwitchColor(getAccentColor(), swSaveHere);
}
});
......
......@@ -55,7 +55,7 @@ public class SecurityActivity extends ThemedActivity {
@Override
public void onClick(View v) {
swActiveSecurity.setChecked(!swActiveSecurity.isChecked());
setSwitchColor(swActiveSecurity, getAccentColor());
setSwitchColor(getAccentColor(), swActiveSecurity);
if (swActiveSecurity.isChecked()) setPasswordDialog();
else Security.clearPassword(getApplicationContext());
toggleEnabledChild(swActiveSecurity.isChecked());
......@@ -70,7 +70,7 @@ public class SecurityActivity extends ThemedActivity {
public void onClick(View v) {
swApplySecurityHidden.setChecked(!swApplySecurityHidden.isChecked());
Security.setPasswordOnHidden(getApplicationContext(), swApplySecurityHidden.isChecked());
setSwitchColor(swApplySecurityHidden, getAccentColor());
setSwitchColor(getAccentColor(), swApplySecurityHidden);
}
});
......@@ -82,7 +82,7 @@ public class SecurityActivity extends ThemedActivity {
public void onClick(View v) {
swApplySecurityDelete.setChecked(!swApplySecurityDelete.isChecked());
Security.setPasswordOnDelete(getApplicationContext(), swApplySecurityDelete.isChecked());
setSwitchColor(swApplySecurityDelete, getAccentColor());
setSwitchColor(getAccentColor(), swApplySecurityDelete);
}
});
}
......@@ -127,7 +127,7 @@ public class SecurityActivity extends ThemedActivity {
@Override
public void onClick(DialogInterface dialog, int which) {
swActiveSecurity.setChecked(false);
setSwitchColor(swActiveSecurity, getAccentColor());
setSwitchColor(getAccentColor(), swActiveSecurity);
toggleEnabledChild(swActiveSecurity.isChecked());
Security.clearPassword(getApplicationContext());
}
......@@ -172,9 +172,9 @@ public class SecurityActivity extends ThemedActivity {
setRecentApp(getString(R.string.security));
toolbar.setBackgroundColor(getPrimaryColor());
setSwitchColor(swActiveSecurity, getAccentColor());
setSwitchColor(swApplySecurityHidden, getAccentColor());
setSwitchColor(swApplySecurityDelete, getAccentColor());
setSwitchColor(getAccentColor(), swActiveSecurity, swApplySecurityHidden, swApplySecurityDelete);
setSwitchColor(getAccentColor(), swApplySecurityHidden);
setSwitchColor(getAccentColor(), swApplySecurityDelete);
toggleEnabledChild(swActiveSecurity.isChecked());
setStatusBarColor();
......
......@@ -193,7 +193,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swShowFab.setChecked(!swShowFab.isChecked());
SP.putBoolean(getString(R.string.preference_show_fab), swShowFab.isChecked());
setSwitchColor(swShowFab, getAccentColor());
setSwitchColor(getAccentColor(), swShowFab);
}
});
......@@ -206,7 +206,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swSubScaling.setChecked(!swSubScaling.isChecked());
SP.putBoolean(getString(R.string.preference_sub_scaling), swSubScaling.isChecked());
setSwitchColor(swSubScaling, getAccentColor());
setSwitchColor(getAccentColor(), swSubScaling);
}
});
......@@ -219,7 +219,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swIncludeVideo.setChecked(!swIncludeVideo.isChecked());
SP.putBoolean(getString(R.string.preference_include_video), swIncludeVideo.isChecked());
setSwitchColor(swIncludeVideo, getAccentColor());
setSwitchColor(getAccentColor(), swIncludeVideo);
}
});
......@@ -232,7 +232,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swSwipeDirection.setChecked(!swSwipeDirection.isChecked());
SP.putBoolean(getString(R.string.preference_swipe_direction_inverted), swSwipeDirection.isChecked());
setSwitchColor(swSwipeDirection, getAccentColor());
setSwitchColor(getAccentColor(), swSwipeDirection);
}
});
......@@ -245,7 +245,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swAutoUpdate.setChecked(!swAutoUpdate.isChecked());
SP.putBoolean(getString(R.string.preference_auto_update_media), swAutoUpdate.isChecked());
setSwitchColor(swAutoUpdate, getAccentColor());
setSwitchColor(getAccentColor(), swAutoUpdate);
}
});
......@@ -258,7 +258,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swUseMediaStore.setChecked(!swUseMediaStore.isChecked());
SP.putBoolean(getString(R.string.preference_use_alternative_provider), swUseMediaStore.isChecked());
setSwitchColor(swUseMediaStore, getAccentColor());
setSwitchColor(getAccentColor(), swUseMediaStore);
}
});
......@@ -271,7 +271,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swDelayFullImage.setChecked(!swDelayFullImage.isChecked());
SP.putBoolean(getString(R.string.preference_delay_full_image), swDelayFullImage.isChecked());
setSwitchColor(swDelayFullImage, getAccentColor());
setSwitchColor(getAccentColor(), swDelayFullImage);
}
});
......@@ -284,7 +284,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swPictureOrientation.setChecked(!swPictureOrientation.isChecked());
SP.putBoolean(getString(R.string.preference_auto_rotate), swPictureOrientation.isChecked());
setSwitchColor(swPictureOrientation, getAccentColor());
setSwitchColor(getAccentColor(), swPictureOrientation);
}
});
......@@ -297,7 +297,7 @@ public class SettingsActivity extends ThemedActivity {
public void onClick(View v) {
swMaxLuminosity.setChecked(!swMaxLuminosity.isChecked());
SP.putBoolean(getString(R.string.preference_max_brightness), swMaxLuminosity.isChecked());
setSwitchColor(swMaxLuminosity, getAccentColor());
setSwitchColor(getAccentColor(), swMaxLuminosity);
}
});
......@@ -312,7 +312,7 @@ public class SettingsActivity extends ThemedActivity {
SP.putBoolean(getString(R.string.preference_translucent_status_bar), swStatusBar.isChecked());
updateTheme();
setStatusBarColor();
setSwitchColor(swStatusBar, getAccentColor());
setSwitchColor(getAccentColor(), swStatusBar);
}
});
......@@ -326,7 +326,7 @@ public class SettingsActivity extends ThemedActivity {
swNavBar.setChecked(!swNavBar.isChecked());
SP.putBoolean(getString(R.string.preference_colored_nav_bar), swNavBar.isChecked());
updateTheme();
setSwitchColor(swNavBar, getAccentColor());
setSwitchColor(getAccentColor(), swNavBar);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
getWindow().setNavigationBarColor(isNavigationBarColored() ? getPrimaryColor() : ContextCompat.getColor(getApplicationContext(), R.color.md_black_1000));
......@@ -355,7 +355,7 @@ public class SettingsActivity extends ThemedActivity {
txtPT.setTextColor(color);
txtVT.setTextColor(color);
txtAT.setTextColor(color);
setSwitchColor(new SwitchCompat[]{
setSwitchColor(color,
swDelayFullImage,
swNavBar,
swStatusBar,
......@@ -366,8 +366,7 @@ public class SettingsActivity extends ThemedActivity {
swSwipeDirection,
swUseMediaStore,
swShowFab,
swSubScaling
}, color);
swSubScaling);
}
public void updateViewsWithPrimaryColor(int color){
......
......@@ -75,7 +75,7 @@ public class SingleMediaActivity extends SharedMediaActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pager);
setContentView(R.layout.activity_single_media);
toolbar = (Toolbar) findViewById(R.id.toolbar);
mViewPager = (HackyViewPager) findViewById(R.id.photos_pager);
......
package org.horaapps.leafpic.activities;
import android.annotation.TargetApi;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.database.Cursor;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -24,18 +18,14 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.view.IconicsImageView;
import org.horaapps.leafpic.R;
import org.horaapps.leafpic.activities.base.ThemedActivity;
import org.horaapps.leafpic.model.HandlingAlbums;
import org.horaapps.leafpic.activities.base.SharedMediaActivity;
import org.horaapps.leafpic.model.base.ImageFileFilter;
import org.horaapps.leafpic.util.AlertDialogsHelper;
import org.horaapps.leafpic.util.ContentHelper;
import org.horaapps.leafpic.util.StringUtils;
import org.jetbrains.annotations.TestOnly;
......@@ -45,9 +35,9 @@ import java.util.ArrayList;
/**
* Created by dnld on 01/04/16.
*/
public class WhiteListActivity extends ThemedActivity {
public class WhiteListActivity extends SharedMediaActivity {
HandlingAlbums tracker;
private int REQUEST_CODE_SD_CARD_PERMISSIONS = 42;
private FloatingActionButton fabWHDone;
......@@ -60,14 +50,12 @@ public class WhiteListActivity extends ThemedActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_track_albums);
setContentView(R.layout.activity_white_list);
toolbar = (Toolbar) findViewById(org.horaapps.leafpic.R.id.toolbar);
mRecyclerView = (RecyclerView) findViewById(org.horaapps.leafpic.R.id.excluded_albums);
fabWHDone = (FloatingActionButton) findViewById(R.id.fab_whitelist_done);
initUi();
tracker = HandlingAlbums.getInstance(getApplicationContext());
alreadyTracked = tracker.getTrackedPaths();
alreadyTracked = getAlbums().getTrackedPaths();
lookForFoldersInMediaStore();
}
......@@ -101,7 +89,11 @@ public class WhiteListActivity extends ThemedActivity {
Item item = new Item(cur.getLong(idColumn),
StringUtils.getBucketPathByImagePath(cur.getString(mediaColumn)),
cur.getString(nameColumn));
item.included = alreadyTracked.contains(item.path);
int indexOf = alreadyTracked.indexOf(item.path);
if (indexOf != -1) {
item.included = true;
alreadyTracked.remove(indexOf);
}
folders.add(item);
}
cur.close();
......@@ -143,9 +135,9 @@ public class WhiteListActivity extends ThemedActivity {
finish();
return true;
*/
case R.id.action_show_music:
/* case R.id.action_show_music:
Toast.makeText(this, "Fuck!", Toast.LENGTH_SHORT).show();
return true;
return true;*/
}
return super.onOptionsItemSelected(item);
}
......@@ -172,7 +164,7 @@ public class WhiteListActivity extends ThemedActivity {
fabWHDone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
tracker.handleItems(folders);
getAlbums().handleItems(folders);
finish();
}
});
......@@ -189,35 +181,6 @@ public class WhiteListActivity extends ThemedActivity {
findViewById(org.horaapps.leafpic.R.id.rl_ea).setBackgroundColor(getBackgroundColor());
}
private void requestSdCardPermissions() {
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(WhiteListActivity.this, getDialogStyle());
AlertDialogsHelper.getTextDialog(WhiteListActivity.this, dialogBuilder,
R.string.sd_card_write_permission_title, R.string.sd_card_permissions_message);
dialogBuilder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP)
startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE), REQUEST_CODE_SD_CARD_PERMISSIONS);
}
});
dialogBuilder.show();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public final void onActivityResult(final int requestCode, final int resultCode, final Intent resultData) {
if (resultCode == RESULT_OK) {
if (requestCode == REQUEST_CODE_SD_CARD_PERMISSIONS) {
Uri treeUri = resultData.getData();
// Persist URI in shared preference so that you can use it later.
ContentHelper.saveSdCardInfo(getApplicationContext(), treeUri);
getContentResolver().takePersistableUriPermission(treeUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
Toast.makeText(this, R.string.got_permission_wr_sdcard, Toast.LENGTH_SHORT).show();
}
}
}
public class Item {
String path;
......@@ -257,8 +220,7 @@ public class WhiteListActivity extends ThemedActivity {
int pos = (int) v.findViewById(R.id.folder_path).getTag();
SwitchCompat s = (SwitchCompat) v.findViewById(R.id.tracked_status);
s.setChecked(folders.get(pos).toggleInclude());
setSwitchColor(s, getAccentColor());
//notifyItemChanged(pos);
setSwitchColor(getAccentColor(), s);
}
};
......@@ -281,7 +243,7 @@ public class WhiteListActivity extends ThemedActivity {
holder.name.setTextColor(getTextColor());
holder.path.setTextColor(getSubTextColor());
holder.imgFolder.setColor(getIconColor());
setSwitchColor(holder.tracked, getAccentColor());
setSwitchColor(getAccentColor(), holder.tracked);
holder.layout.setBackgroundColor(getCardBackgroundColor());
}
......
......@@ -199,15 +199,9 @@ public abstract class ThemedActivity extends AppCompatActivity implements UiElem
protected void themeButton(Button btn) {themeHelper.themeButton(btn);}
public void setSwitchColor(SwitchCompat sw, int color){
themeHelper.setSwitchCompactColor(sw, color);
}
public void setSwitchColor(SwitchCompat sw[], int color){
for (SwitchCompat switchCompat : sw) {
public void setSwitchColor(int color, SwitchCompat... sw){
for (SwitchCompat switchCompat : sw)
themeHelper.setSwitchCompactColor(switchCompat, color);
}
}
public IconicsDrawable getToolbarIcon(IIcon icon){
......
......@@ -47,10 +47,10 @@ public class SinglePhotoSetting extends ThemedSetting {
@Override
public void onClick(View v) {
swApplyTheme.setChecked(!swApplyTheme.isChecked());
getActivity().setSwitchColor(swApplyTheme, getActivity().getAccentColor());
getActivity().setSwitchColor(getActivity().getAccentColor(), swApplyTheme);
}
});
getActivity().setSwitchColor(swApplyTheme, getActivity().getAccentColor());
getActivity().setSwitchColor(getActivity().getAccentColor(), swApplyTheme);
final LineColorPicker transparencyColorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.pickerTransparent);
transparencyColorPicker.setColors(ColorPalette.getTransparencyShadows(getActivity().getPrimaryColor()));
......
......@@ -77,7 +77,7 @@ public final class CustomExoPlayerView extends FrameLayout {
}
}
LayoutInflater.from(context).inflate(R.layout.custom_exo_player_view, this);
LayoutInflater.from(context).inflate(R.layout.exo_player, this);
componentListener = new ComponentListener();
layout = (AspectRatioFrameLayout) findViewById(R.id.video_frame);
layout.setResizeMode(resizeMode);
......
......@@ -116,7 +116,7 @@ public class CustomPlayBackController extends FrameLayout {
formatter = new Formatter(formatBuilder, Locale.getDefault());
componentListener = new ComponentListener();
LayoutInflater.from(context).inflate(R.layout.exo_playback_control_view, this);
LayoutInflater.from(context).inflate(R.layout.exo_media_control, this);
time = (TextView) findViewById(R.id.time);
timeCurrent = (TextView) findViewById(R.id.time_current);
progressBar = (SeekBar) findViewById(R.id.mediacontroller_progress);
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/editexif_background">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:background="@color/md_dark_appbar"
android:windowActionBarOverlay="true"
/>
<ScrollView
android:id="@+id/editexifAct_scrollView"
android:scrollbarSize="4dip"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--HEADER-->
<android.support.v7.widget.CardView
android:id="@+id/editexif_reset_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:cardCornerRadius="1dp"
app:cardElevation="5dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/editexif_img"
android:layout_width="match_parent"
android:layout_height="250dp"
android:scaleType="centerCrop"
/>
<TextView
android:id="@+id/editexif_image_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:text="path"
android:textSize="14dp"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
<!--FIELDS-->
<android.support.v7.widget.CardView
android:id="@+id/editexif_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
app:cardCornerRadius="1dp"
app:cardElevation="5dp"
>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar"
android:background="@color/md_dark_appbar"
android:windowActionBarOverlay="true"
/>
<RelativeLayout
android:id="@+id/rl_ea"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/excluded_albums"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/nothing_to_show"
android:text="@string/there_is_nothing_to_show"
android:textColor="@color/md_white_1000"
android:visibility="invisible"
android:textSize="@dimen/sub_big_text"
android:gravity="center"
android:layout_centerInParent="true"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
......@@ -92,7 +92,7 @@
</android.support.design.widget.CoordinatorLayout>
<include
android:id="@+id/drawer_items"
layout="@layout/activity_drawer"/>
layout="@layout/drawer"/>
</android.support.v4.widget.DrawerLayout>
This diff is collapsed.
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!--
<item
android:id="@+id/action_done"
android:title="@string/done"
app:showAsAction="always"
app:showAsAction="ifRoom"
/>
-->
<item
android:id="@+id/action_add"
android:title="@string/add"
app:showAsAction="always"
/>
<!--<item
android:id="@+id/action_show_music"
android:title="Show Music folder"
app:showAsAction="never"
/>
/>-->
</menu>
\ No newline at end of file
......@@ -327,4 +327,5 @@
<string name="white_list">White list</string>
<string name="chose_albums_to_display">Chose albums to display</string>
<string name="use_primary_color_in_the_viewer">Use primary color in the viewer</string>
<string name="add">Add</string>
</resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment