mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-19 23:07:42 +00:00
nothing
This commit is contained in:
parent
92c795c60f
commit
66a01ca07c
9 changed files with 83 additions and 9 deletions
|
|
@ -185,6 +185,7 @@ dependencies {
|
|||
transitive = true
|
||||
}
|
||||
implementation 'com.google.android.gms:play-services-maps3d:0.2.0'
|
||||
//implementation 'com.google.android.gms:play-services-maps:19.0.0'
|
||||
}
|
||||
|
||||
/*def void dumpProperties(it){
|
||||
|
|
|
|||
|
|
@ -224,6 +224,7 @@
|
|||
|
||||
</activity>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".InfoActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ import androidx.activity.result.ActivityResultCallback;
|
|||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
|
@ -147,17 +148,25 @@ public class MainActivity extends BaseActivity implements OnKeyboardEventListene
|
|||
private static final String userTextSizeKey = "UserTextSize";
|
||||
private Toolbar toolbar;
|
||||
private Menu menu;
|
||||
|
||||
private static Dataset repo;
|
||||
private boolean didExecuteParser = false;
|
||||
|
||||
DownloadResultReceiver resultReceiver;
|
||||
private static ProgressDialog progressDialog;
|
||||
private static final String PREFS_NAME = "settings";
|
||||
private static final String KEY_THEME_MODE = "theme_mode";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(R.style.AppTheme);
|
||||
// 1. Load the saved preference first
|
||||
SharedPreferences theme_prefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
int savedMode = theme_prefs.getInt(KEY_THEME_MODE, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
|
||||
// 2. Apply it before the UI draws
|
||||
AppCompatDelegate.setDefaultNightMode(savedMode);
|
||||
getDelegate().applyDayNight();
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
context = this;
|
||||
|
||||
checkSendCrashReport();
|
||||
|
|
@ -269,6 +278,10 @@ public class MainActivity extends BaseActivity implements OnKeyboardEventListene
|
|||
drawerLayout.closeDrawers();
|
||||
startActivity(new Intent(context, InfoActivity.class));
|
||||
}
|
||||
else if (id == R.id.nav_palette) {
|
||||
drawerLayout.closeDrawers();
|
||||
openThemeDialog();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
@ -1444,4 +1457,45 @@ public class MainActivity extends BaseActivity implements OnKeyboardEventListene
|
|||
outStream.flush();
|
||||
outStream.close();
|
||||
}
|
||||
private void openThemeDialog() {
|
||||
String[] options = {"Dark Mode", "Light Mode", "System Default"};
|
||||
|
||||
SharedPreferences themePrefs = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
|
||||
int currentMode = themePrefs.getInt(KEY_THEME_MODE, AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
|
||||
int checkedItem;
|
||||
if (currentMode == AppCompatDelegate.MODE_NIGHT_YES) checkedItem = 0;
|
||||
else if (currentMode == AppCompatDelegate.MODE_NIGHT_NO) checkedItem = 1;
|
||||
else checkedItem = 2;
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("Choose Theme");
|
||||
|
||||
builder.setSingleChoiceItems(options, checkedItem, (dialog, which) -> {
|
||||
int modeToApply;
|
||||
switch (which) {
|
||||
case 0:
|
||||
modeToApply = AppCompatDelegate.MODE_NIGHT_YES;
|
||||
break;
|
||||
case 1:
|
||||
modeToApply = AppCompatDelegate.MODE_NIGHT_NO;
|
||||
break;
|
||||
default:
|
||||
modeToApply = AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
|
||||
break;
|
||||
}
|
||||
|
||||
// Save selection
|
||||
themePrefs.edit().putInt(KEY_THEME_MODE, modeToApply).apply();
|
||||
|
||||
// Apply immediately
|
||||
AppCompatDelegate.setDefaultNightMode(modeToApply);
|
||||
getDelegate().applyDayNight();
|
||||
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
builder.setNegativeButton("Cancel", (dialog, which) -> dialog.dismiss());
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
android/KMAPro/kMAPro/src/main/res/drawable/ic_palette.xml
Normal file
10
android/KMAPro/kMAPro/src/main/res/drawable/ic_palette.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal"> <path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M480,880Q398,880 325,848.5Q252,817 197.5,762.5Q143,708 111.5,635Q80,562 80,480Q80,398 111.5,325Q143,252 197.5,197.5Q252,143 325,111.5Q398,80 480,80Q497,80 508.5,91.5Q520,103 520,120Q520,137 508.5,148.5Q497,160 480,160Q347,160 253.5,253.5Q160,347 160,480Q160,613 253.5,706.5Q347,800 480,800Q501,800 515.5,814.5Q530,829 530,850Q530,867 518.5,878.5Q507,890 490,890Q485,880 480,880ZM700,440Q675,440 657.5,422.5Q640,405 640,380Q640,355 657.5,337.5Q675,320 700,320Q725,320 742.5,337.5Q760,355 760,380Q760,405 742.5,422.5Q725,440 700,440ZM540,320Q515,320 497.5,302.5Q480,285 480,260Q480,235 497.5,217.5Q515,200 540,200Q565,200 582.5,217.5Q600,235 600,260Q600,285 582.5,302.5Q565,320 540,320ZM340,320Q315,320 297.5,302.5Q280,285 280,260Q280,235 297.5,217.5Q315,200 340,200Q365,200 382.5,217.5Q400,235 400,260Q400,285 382.5,302.5Q365,320 340,320ZM220,440Q195,440 177.5,422.5Q160,405 160,380Q160,355 177.5,337.5Q195,320 220,320Q245,320 262.5,337.5Q280,355 280,380Q280,405 262.5,422.5Q245,440 220,440Z"/>
|
||||
</vector>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:gravity="bottom"
|
||||
|
|
@ -7,13 +8,12 @@
|
|||
android:paddingHorizontal="5dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="2dp"
|
||||
>
|
||||
android:background="@color/yellow_background">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/keyman_logo"
|
||||
/>
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/keyman_logo_mode" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
<!-- android:icon="@drawable/ic_light_action_share" />-->
|
||||
|
||||
<menu>
|
||||
<item android:id="@+id/action_share"
|
||||
<item android:id="@+id/action_share"
|
||||
app:showAsAction="always"
|
||||
android:title="@string/action_share"
|
||||
android:icon="@drawable/ic_light_action_share" />
|
||||
|
|
|
|||
|
|
@ -66,7 +66,10 @@
|
|||
android:icon="@drawable/ic_info_outline"
|
||||
android:title="Send Crash Report"
|
||||
app:actionLayout="@layout/nav_switch_item" />
|
||||
|
||||
<item
|
||||
android:id="@+id/nav_palette"
|
||||
android:icon="@drawable/ic_palette"
|
||||
android:title="Appearance Mode" />
|
||||
<item
|
||||
android:id="@+id/nav_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
<color name="neutral_3">#929396</color>
|
||||
<color name="neutral_4">#C9CACA</color>
|
||||
<color name="neutral_5">#DADDDC</color>
|
||||
<color name="ms_black">#000000</color>
|
||||
|
||||
|
||||
<color name="keyman_orange">@color/analagous_5</color>
|
||||
|
|
|
|||
|
|
@ -50,4 +50,8 @@
|
|||
<item name="android:popupBackground">@color/menuBgColor</item>
|
||||
</style>
|
||||
|
||||
<!-- <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">-->
|
||||
<!-- <item name="android:windowBackground">@color/splashBackground</item>-->
|
||||
<!-- </style>-->
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue