diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/LicenseActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/LicenseActivity.java deleted file mode 100644 index 7a1ca6ea1..000000000 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/LicenseActivity.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.simplemobiletools.gallery.activities; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; - -import com.simplemobiletools.gallery.R; - -import butterknife.ButterKnife; -import butterknife.OnClick; - -public class LicenseActivity extends SimpleActivity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_license); - ButterKnife.bind(this); - } - - @OnClick(R.id.license_butterknife_title) - public void butterKnifeClicked() { - openUrl(R.string.butterknife_url); - } - - @OnClick(R.id.license_photoview_title) - public void photoViewClicked() { - openUrl(R.string.photoview_url); - } - - @OnClick(R.id.license_glide_title) - public void glideClicked() { - openUrl(R.string.glide_url); - } - - @OnClick(R.id.license_cropper_title) - public void cropperClicked() { - openUrl(R.string.cropper_url); - } - - private void openUrl(int id) { - final String url = getResources().getString(id); - final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - startActivity(browserIntent); - } -} diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotoActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/PhotoActivity.java deleted file mode 100644 index 91dcd54c5..000000000 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotoActivity.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.simplemobiletools.gallery.activities; - -import android.os.Bundle; - -public class PhotoActivity extends PhotoVideoActivity { - - @Override - public void onCreate(Bundle savedInstanceState) { - mIsVideo = false; - super.onCreate(savedInstanceState); - } -} diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java deleted file mode 100644 index 881effb9a..000000000 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/SettingsActivity.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.simplemobiletools.gallery.activities; - -import android.os.Bundle; -import android.support.v4.app.TaskStackBuilder; -import android.support.v7.widget.SwitchCompat; - -import com.simplemobiletools.gallery.Config; -import com.simplemobiletools.gallery.R; - -import butterknife.BindView; -import butterknife.ButterKnife; -import butterknife.OnClick; - -public class SettingsActivity extends SimpleActivity { - @BindView(R.id.settings_dark_theme) SwitchCompat mDarkThemeSwitch; - @BindView(R.id.settings_same_sorting) SwitchCompat mSameSortingSwitch; - @BindView(R.id.settings_show_hidden_folders) SwitchCompat mShowHiddenFoldersSwitch; - @BindView(R.id.settings_autoplay_videos) SwitchCompat mAutoplayVideosSwitch; - - private static Config mConfig; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_settings); - mConfig = Config.newInstance(getApplicationContext()); - ButterKnife.bind(this); - - setupDarkTheme(); - setupSameSorting(); - setupShowHiddenFolders(); - setupAutoplayVideos(); - } - - private void setupDarkTheme() { - mDarkThemeSwitch.setChecked(mConfig.getIsDarkTheme()); - } - - private void setupSameSorting() { - mSameSortingSwitch.setChecked(mConfig.getIsSameSorting()); - } - - private void setupShowHiddenFolders() { - mShowHiddenFoldersSwitch.setChecked(mConfig.getShowHiddenFolders()); - } - - private void setupAutoplayVideos() { - mAutoplayVideosSwitch.setChecked(mConfig.getAutoplayVideos()); - } - - @OnClick(R.id.settings_dark_theme_holder) - public void handleDarkTheme() { - mDarkThemeSwitch.setChecked(!mDarkThemeSwitch.isChecked()); - mConfig.setIsDarkTheme(mDarkThemeSwitch.isChecked()); - restartActivity(); - } - - @OnClick(R.id.settings_same_sorting_holder) - public void handleSameSorting() { - mSameSortingSwitch.setChecked(!mSameSortingSwitch.isChecked()); - mConfig.setIsSameSorting(mSameSortingSwitch.isChecked()); - } - - @OnClick(R.id.settings_show_hidden_folders_holder) - public void handleShowHiddenFolders() { - mShowHiddenFoldersSwitch.setChecked(!mShowHiddenFoldersSwitch.isChecked()); - mConfig.setShowHiddenFolders(mShowHiddenFoldersSwitch.isChecked()); - } - - @OnClick(R.id.settings_autoplay_videos_holder) - public void handleAutoplayVideos() { - mAutoplayVideosSwitch.setChecked(!mAutoplayVideosSwitch.isChecked()); - mConfig.setAutoplayVideos(mAutoplayVideosSwitch.isChecked()); - } - - private void restartActivity() { - TaskStackBuilder.create(getApplicationContext()).addNextIntentWithParentStack(getIntent()).startActivities(); - } -} diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/VideoActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/VideoActivity.java deleted file mode 100644 index bea0ab11f..000000000 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/VideoActivity.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.simplemobiletools.gallery.activities; - -import android.os.Bundle; - -public class VideoActivity extends PhotoVideoActivity { - - @Override - public void onCreate(Bundle savedInstanceState) { - mIsVideo = true; - super.onCreate(savedInstanceState); - } -} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/LicenseActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/LicenseActivity.kt new file mode 100644 index 000000000..b109db679 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/LicenseActivity.kt @@ -0,0 +1,25 @@ +package com.simplemobiletools.gallery.activities + +import android.content.Intent +import android.net.Uri +import android.os.Bundle +import com.simplemobiletools.gallery.R +import kotlinx.android.synthetic.main.activity_license.* + +class LicenseActivity : SimpleActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_license) + + license_butterknife_title.setOnClickListener { openUrl(R.string.butterknife_url) } + license_photoview_title.setOnClickListener { openUrl(R.string.photoview_url) } + license_glide_title.setOnClickListener { openUrl(R.string.glide_url) } + license_cropper_title.setOnClickListener { openUrl(R.string.cropper_url) } + } + + private fun openUrl(id: Int) { + val url = resources.getString(id) + val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + startActivity(browserIntent) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoActivity.kt new file mode 100644 index 000000000..31575b58f --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoActivity.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.gallery.activities + +import android.os.Bundle + +class PhotoActivity : PhotoVideoActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + PhotoVideoActivity.mIsVideo = false + super.onCreate(savedInstanceState) + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt new file mode 100644 index 000000000..a6859ba2b --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt @@ -0,0 +1,54 @@ +package com.simplemobiletools.gallery.activities + +import android.os.Bundle +import android.support.v4.app.TaskStackBuilder +import com.simplemobiletools.gallery.R +import kotlinx.android.synthetic.main.activity_settings.* + +class SettingsActivity : SimpleActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_settings) + + setupDarkTheme() + setupSameSorting() + setupShowHiddenFolders() + setupAutoplayVideos() + } + + private fun setupDarkTheme() { + settings_dark_theme.isChecked = mConfig.isDarkTheme + settings_dark_theme_holder.setOnClickListener { + settings_dark_theme.toggle() + mConfig.isDarkTheme = settings_dark_theme.isChecked + restartActivity() + } + } + + private fun setupSameSorting() { + settings_same_sorting.isChecked = mConfig.isSameSorting + settings_same_sorting_holder.setOnClickListener { + settings_same_sorting.toggle() + mConfig.isSameSorting = settings_same_sorting.isChecked + } + } + + private fun setupShowHiddenFolders() { + settings_show_hidden_folders.isChecked = mConfig.showHiddenFolders + settings_show_hidden_folders_holder.setOnClickListener { + settings_show_hidden_folders.toggle() + mConfig.showHiddenFolders = settings_show_hidden_folders.isChecked + } + } + + private fun setupAutoplayVideos() { + settings_autoplay_videos_holder.setOnClickListener { + settings_autoplay_videos.toggle() + mConfig.autoplayVideos = settings_autoplay_videos.isChecked + } + } + + private fun restartActivity() { + TaskStackBuilder.create(applicationContext).addNextIntentWithParentStack(intent).startActivities() + } +} diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt new file mode 100644 index 000000000..fa38734e3 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/VideoActivity.kt @@ -0,0 +1,11 @@ +package com.simplemobiletools.gallery.activities + +import android.os.Bundle + +class VideoActivity : PhotoVideoActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + PhotoVideoActivity.mIsVideo = true + super.onCreate(savedInstanceState) + } +}