Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0539bf6
Replace jcenter() with mavenCentral()
louis-hildebrand Oct 18, 2024
a73b641
Upgrade to newer versions of Gradle, etc.
louis-hildebrand Oct 18, 2024
95dad97
Add vintage-chroma dependency as subproject
louis-hildebrand Oct 18, 2024
44d36b0
Fix settings page crashing
louis-hildebrand Oct 18, 2024
ac1aafa
Implement bare-bones 3-style corners trainer
louis-hildebrand Oct 27, 2024
ed2d041
Comment out line that's crashing category select dialog
louis-hildebrand Oct 27, 2024
86bc1e1
Add dialog to select cases for 3-style trainer
louis-hildebrand Nov 1, 2024
6e27321
Merge branch 'master' into 3sc-trainer
louis-hildebrand Nov 1, 2024
5cd6e4e
Support custom letter scheme for 3-style trainer
louis-hildebrand Nov 3, 2024
3883d4b
Add instructions for selecting cases and letter scheme
louis-hildebrand Nov 10, 2024
daef5a1
Clean up 3-style case select logic a bit
louis-hildebrand Nov 10, 2024
0e8382c
Let user choose their own buffer
louis-hildebrand Nov 20, 2024
b1a4d6b
Fix some bugs in 3-style case generation
louis-hildebrand Nov 21, 2024
a0d42a9
Prevent scramble from being inverse of solution
louis-hildebrand Nov 21, 2024
0d6f850
Add some randomness to trainer scrambles
louis-hildebrand Nov 22, 2024
4b56ce4
Clear some final TODO comments
louis-hildebrand Nov 23, 2024
c421ce1
Merge pull request #1 from louis-hildebrand/3sc-trainer
louis-hildebrand Nov 24, 2024
9c681aa
Fix crashing dialogs
louis-hildebrand Nov 24, 2024
6c30218
Always show trainer case name
louis-hildebrand Jan 5, 2025
fef59cf
Fix typos in TimerFragment.onSaveInstanceState
louis-hildebrand May 19, 2025
12cf1d7
Fix app crashing in landscape mode
louis-hildebrand May 19, 2025
713dceb
Name corner twist cases differently
louis-hildebrand May 21, 2025
d1430a1
Upgrade butterknife to 10.2.3
louis-hildebrand May 23, 2025
22aadd4
Distinguish between case name and ID; use name for case selection
louis-hildebrand May 23, 2025
2a63580
Merge pull request #2 from louis-hildebrand/show-case-in-timer
louis-hildebrand Jun 5, 2025
03b9a70
Write script clean.sh
louis-hildebrand Jun 28, 2025
2131b1c
Update clean.sh
louis-hildebrand Jul 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/vintage-chroma"]
path = lib/vintage-chroma
url = https://github.com/louis-hildebrand/VintageChroma.git
18 changes: 12 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
}
}
compileSdkVersion 33
buildToolsVersion '28.0.3'
buildToolsVersion '29.0.2'
defaultConfig {
applicationId "com.aricneto.twistytimer"
minSdkVersion 16
Expand Down Expand Up @@ -56,10 +56,11 @@ dependencies {
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation "androidx.annotation:annotation:1.1.0"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta3'
implementation 'com.takisoft.fix:preference-v7:26.0.1.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'com.android.support:multidex:1.0.3'
// Butterknife ("apt" dependency is defined in root "build.gradle" script).
implementation 'com.jakewharton:butterknife:10.0.0'
implementation 'com.jakewharton:butterknife:10.2.3'
testImplementation project(':app')
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
// Observable scrollview
implementation 'com.github.ksoichiro:android-observablescrollview:1.5.2'
Expand Down Expand Up @@ -87,13 +88,18 @@ dependencies {
// Inapp Billing
implementation 'com.anjlab.android.iab.v3:library:2.0.3'
// Material color picker
implementation 'com.pavelsikun:vintage-chroma:1.5'
implementation project(':lib:vintage-chroma:library')

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
}

repositories {
jcenter()
maven { url 'http://maven.google.com' }
maven { url 'https://jitpack.io' }
}

tasks.withType(Test) {
testLogging {
events "passed", "skipped", "failed"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package com.aricneto.twistify;

import android.app.Application;
import android.test.ApplicationTestCase;
// TODO: compiler says android.test does not exist
// Adding dependency androidTestImplementation 'com.google.android:android-test:4.1.1.4' in build.gradle
// seems to solve that issue, but then causes others...
//import android.test.ApplicationTestCase;
//
///**
// * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
// */
//public class ApplicationTest extends ApplicationTestCase<Application> {
// public ApplicationTest() {
// super(Application.class);
// }
//}

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
public class ApplicationTest {}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public class MainActivity extends AppCompatActivity
private static final int SETTINGS_ID = 5;
private static final int TRAINER_OLL_ID = 14;
private static final int TRAINER_PLL_ID = 15;
private static final int TRAINER_3STYLE_CORNERS_ID = 16;


private static final int REQUEST_SETTING = 42;
Expand Down Expand Up @@ -302,7 +303,13 @@ private void handleDrawer(Bundle savedInstanceState) {
.withLevel(2)
.withIcon(R.drawable.ic_pll_black_24dp)
.withIconTintingEnabled(true)
.withIdentifier(TRAINER_PLL_ID)),
.withIdentifier(TRAINER_PLL_ID),
new SecondaryDrawerItem()
.withName(R.string.drawer_title_3style_corners)
.withLevel(2)
.withIcon(R.drawable.ic_3style_corners_black_24dp)
.withIconTintingEnabled(true)
.withIdentifier(TRAINER_3STYLE_CORNERS_ID)),

new ExpandableDrawerItem()
.withName(R.string.title_algorithms)
Expand Down Expand Up @@ -418,6 +425,19 @@ public void run() {
});
break;

case TRAINER_3STYLE_CORNERS_ID:
mDrawerToggle.runWhenIdle(new Runnable() {
@Override
public void run() {
fragmentManager
.beginTransaction()
.replace(R.id.main_activity_container,
TimerFragmentMain.newInstance(TrainerScrambler.TrainerSubset.THREE_STYLE_CORNERS.name(), "Normal", TimerFragment.TIMER_MODE_TRAINER, TrainerScrambler.TrainerSubset.THREE_STYLE_CORNERS), "fragment_main")
.commit();
}
});
break;

case OLL_ID:
mDrawerToggle.runWhenIdle(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
import com.aricneto.twistytimer.fragment.dialog.CrossHintFaceSelectDialog;
import com.aricneto.twistytimer.fragment.dialog.LocaleSelectDialog;
import com.aricneto.twistytimer.listener.OnBackPressedInFragmentListener;
import com.aricneto.twistytimer.puzzle.CornerSticker;
import com.aricneto.twistytimer.puzzle.LetterScheme;
import com.aricneto.twistytimer.utils.LocaleUtils;
import com.aricneto.twistytimer.utils.Prefs;
import com.aricneto.twistytimer.utils.ThemeUtils;
import com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat;

import java.lang.ref.PhantomReference;
import java.util.function.Function;
import androidx.preference.PreferenceFragmentCompat;

import butterknife.BindView;
import butterknife.ButterKnife;
Expand Down Expand Up @@ -149,6 +148,8 @@ public boolean onPreferenceClick(androidx.preference.Preference preference) {
R.string.pk_scramble_text_size,
R.string.pk_advanced_timer_settings_enabled,
R.string.pk_stat_trim_size,
R.string.pk_corner_letter_scheme,
R.string.pk_corner_buffer,
R.string.pk_stat_acceptable_dnf_size,
R.string.pk_timer_animation_duration)) {

Expand Down Expand Up @@ -269,6 +270,12 @@ public void onStopTrackingTouch(SeekBar seekBar) {
trimChangeListener.onProgressChanged(trimSeekBar, trimSeekBar.getProgress(), false);
trimDialogView.show();
break;
case R.string.pk_corner_letter_scheme:
createLetterSchemeDialog(R.string.pk_corner_letter_scheme, R.string.corner_letter_scheme);
break;
case R.string.pk_corner_buffer:
createCornerStickerDialog(R.string.pk_corner_buffer, R.string.corner_buffer_title);
break;
case R.string.pk_stat_acceptable_dnf_size:
MaterialDialog dnfDialogView = createAverageSeekDialog(R.string.pk_stat_acceptable_dnf_size,
0,
Expand Down Expand Up @@ -319,22 +326,24 @@ public void onStopTrackingTouch(SeekBar seekBar) {
}
};


@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);

super.onCreate(savedInstanceState);
this.onCreatePreferences(savedInstanceState, null);

mContext = getContext();

averageText = getString(R.string.graph_legend_avg_prefix);
}

@Override
public void onCreatePreferencesFix(Bundle bundle, String rootKey) {
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
setPreferencesFromResource(R.xml.prefs, rootKey);

int listenerPrefIds[] = {R.string.pk_inspection_time,
int listenerPrefIds[] = {
R.string.pk_inspection_time,
R.string.pref_screen_title_timer_appearance_settings,
R.string.pk_show_scramble_x_cross_hints,
R.string.pk_locale,
Expand All @@ -344,12 +353,18 @@ public void onCreatePreferencesFix(Bundle bundle, String rootKey) {
R.string.pk_scramble_image_size,
R.string.pk_advanced_timer_settings_enabled,
R.string.pk_stat_trim_size,
R.string.pk_stat_acceptable_dnf_size,
R.string.pk_timer_animation_duration};
// TODO: this seems to be missing
// R.string.pk_stat_acceptable_dnf_size,
R.string.pk_timer_animation_duration,
R.string.pk_corner_letter_scheme,
R.string.pk_corner_buffer
};

for (int prefId : listenerPrefIds) {
findPreference(getString(prefId))
.setOnPreferenceClickListener(clickListener);
Preference pref = findPreference(getString(prefId));
if (pref != null) {
pref.setOnPreferenceClickListener(clickListener);
}
}

mainScreen = getPreferenceScreen();
Expand Down Expand Up @@ -397,6 +412,53 @@ public boolean onBackPressedInFragment() {
return false;
}

private void createLetterSchemeDialog(final int prefKeyResID, @StringRes int title) {
ThemeUtils.roundAndShowDialog(mContext, new MaterialDialog.Builder(mContext)
.title(title)
.content(R.string.corner_letter_scheme_hint)
.input(
"",
Prefs.getString(prefKeyResID, LetterScheme.SPEFFZ_LETTERS),
(dialog, input) -> {
try {
String s = input.toString();
new LetterScheme(s);
Prefs.edit().putString(prefKeyResID, s).apply();
} catch (IllegalArgumentException e) {
// TODO: Show this without closing the popup?
Toast.makeText(getActivity(), R.string.invalid_letter_scheme, Toast.LENGTH_SHORT).show();
}
})
.positiveText(R.string.action_done)
.negativeText(R.string.action_cancel)
.neutralText(R.string.action_default)
.onNeutral((dialog, which) -> Prefs.edit().putString(prefKeyResID, LetterScheme.SPEFFZ_LETTERS).apply())
.build());
}

private void createCornerStickerDialog(final int prefKeyResID, @StringRes int title) {
ThemeUtils.roundAndShowDialog(mContext, new MaterialDialog.Builder(mContext)
.title(title)
.input(
"",
Prefs.getString(prefKeyResID, getString(R.string.default_corner_buffer)),
(dialog, input) -> {
try {
String s = input.toString();
CornerSticker.parse(s);
Prefs.edit().putString(prefKeyResID, s).apply();
} catch (IllegalArgumentException e) {
// TODO: Show this without closing the popup?
Toast.makeText(getActivity(), R.string.invalid_sticker, Toast.LENGTH_SHORT).show();
}
})
.positiveText(R.string.action_done)
.negativeText(R.string.action_cancel)
.neutralText(R.string.action_default)
.onNeutral((dialog, which) -> Prefs.edit().putString(prefKeyResID, getString(R.string.default_corner_buffer)).apply())
.build());
}

private void createNumberDialog(@StringRes int title, final int prefKeyResID) {
ThemeUtils.roundAndShowDialog(mContext, new MaterialDialog.Builder(mContext)
.title(title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Locale;

import androidx.cardview.widget.CardView;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;

Expand Down Expand Up @@ -51,7 +50,7 @@ public TrainerCursorAdapter(Context context, Cursor cursor, Fragment listFragmen
Color.BLACK, 14, 2);

selectedItems = new ArrayList<>();
selectedItems.addAll(TrainerScrambler.fetchSelectedItems(subset, category));
selectedItems.addAll(TrainerScrambler.fetchCaseSelection(subset, category));

this.currentSubset = subset;
this.currentPuzzleCategory = category;
Expand All @@ -62,11 +61,6 @@ private boolean isSelected(String name) {
return selectedItems.contains(name);
}

public void unselectAll() {
selectedItems.clear();
TrainerScrambler.saveSelectedItems(currentSubset, currentPuzzleCategory, selectedItems);
}

public void selectAll() {
int size = selectedItems.size();
Log.d("TRAINER","selecteditems: " + size);
Expand All @@ -84,8 +78,10 @@ public void selectAll() {
selectedItems.addAll(Arrays.asList(pll_cases));
}
break;
case THREE_STYLE_CORNERS:
throw new IllegalArgumentException("TrainerCursorAdapter should not be used for 3-style corners.");
}
TrainerScrambler.saveSelectedItems(currentSubset, currentPuzzleCategory, selectedItems);
TrainerScrambler.saveCaseSelection(currentSubset, currentPuzzleCategory, selectedItems);
}

private void toggleSelection(String name, CardView card) {
Expand All @@ -96,7 +92,7 @@ private void toggleSelection(String name, CardView card) {
selectedItems.remove(name);
card.setBackground(cardBackground);
}
TrainerScrambler.saveSelectedItems(currentSubset, currentPuzzleCategory, selectedItems);
TrainerScrambler.saveCaseSelection(currentSubset, currentPuzzleCategory, selectedItems);
}

@Override
Expand Down
Loading