mirror of
				https://github.com/SimpleMobileTools/Simple-App-Launcher.git
				synced 2025-06-05 21:49:21 +02:00 
			
		
		
		
	add Settings activity
This commit is contained in:
		| @@ -26,5 +26,10 @@ | |||||||
|             android:name=".activities.LicenseActivity" |             android:name=".activities.LicenseActivity" | ||||||
|             android:label="@string/third_party_licences" |             android:label="@string/third_party_licences" | ||||||
|             android:parentActivityName=".activities.AboutActivity"/> |             android:parentActivityName=".activities.AboutActivity"/> | ||||||
|  |  | ||||||
|  |         <activity | ||||||
|  |             android:name=".activities.SettingsActivity" | ||||||
|  |             android:label="@string/settings" | ||||||
|  |             android:parentActivityName=".activities.MainActivity"/> | ||||||
|     </application> |     </application> | ||||||
| </manifest> | </manifest> | ||||||
|   | |||||||
| @@ -23,6 +23,10 @@ class MainActivity : AppCompatActivity() { | |||||||
|  |  | ||||||
|     override fun onOptionsItemSelected(item: MenuItem?): Boolean { |     override fun onOptionsItemSelected(item: MenuItem?): Boolean { | ||||||
|         when (item?.itemId) { |         when (item?.itemId) { | ||||||
|  |             R.id.settings -> { | ||||||
|  |                 startActivity(Intent(applicationContext, SettingsActivity::class.java)) | ||||||
|  |                 return true | ||||||
|  |             } | ||||||
|             R.id.about -> { |             R.id.about -> { | ||||||
|                 startActivity(Intent(applicationContext, AboutActivity::class.java)) |                 startActivity(Intent(applicationContext, AboutActivity::class.java)) | ||||||
|                 return true |                 return true | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | package com.simplemobiletools.applauncher.activities | ||||||
|  |  | ||||||
|  | import android.os.Bundle | ||||||
|  | import android.support.v7.app.AppCompatActivity | ||||||
|  | import com.simplemobiletools.applauncher.R | ||||||
|  |  | ||||||
|  | class SettingsActivity : AppCompatActivity() { | ||||||
|  |  | ||||||
|  |     override fun onCreate(savedInstanceState: Bundle?) { | ||||||
|  |         super.onCreate(savedInstanceState) | ||||||
|  |         setContentView(R.layout.activity_settings) | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										40
									
								
								app/src/main/res/layout/activity_settings.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								app/src/main/res/layout/activity_settings.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <ScrollView | ||||||
|  |     android:id="@+id/settings_scrollview" | ||||||
|  |     xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|  |     android:layout_width="match_parent" | ||||||
|  |     android:layout_height="wrap_content"> | ||||||
|  |  | ||||||
|  |     <LinearLayout | ||||||
|  |         android:id="@+id/settings_holder" | ||||||
|  |         android:layout_width="match_parent" | ||||||
|  |         android:layout_height="wrap_content" | ||||||
|  |         android:orientation="vertical"> | ||||||
|  |  | ||||||
|  |         <RelativeLayout | ||||||
|  |             android:id="@+id/settings_dark_theme_holder" | ||||||
|  |             android:layout_width="match_parent" | ||||||
|  |             android:layout_height="wrap_content" | ||||||
|  |             android:layout_marginTop="@dimen/settings_padding" | ||||||
|  |             android:background="?android:attr/selectableItemBackground" | ||||||
|  |             android:padding="@dimen/activity_margin"> | ||||||
|  |  | ||||||
|  |             <TextView | ||||||
|  |                 android:id="@+id/settings_dark_theme_label" | ||||||
|  |                 android:layout_width="wrap_content" | ||||||
|  |                 android:layout_height="wrap_content" | ||||||
|  |                 android:layout_centerVertical="true" | ||||||
|  |                 android:paddingLeft="@dimen/settings_padding" | ||||||
|  |                 android:text="@string/dark_theme"/> | ||||||
|  |  | ||||||
|  |             <android.support.v7.widget.SwitchCompat | ||||||
|  |                 android:id="@+id/settings_dark_theme" | ||||||
|  |                 android:layout_width="wrap_content" | ||||||
|  |                 android:layout_height="wrap_content" | ||||||
|  |                 android:layout_alignParentRight="true" | ||||||
|  |                 android:background="@null" | ||||||
|  |                 android:clickable="false"/> | ||||||
|  |  | ||||||
|  |         </RelativeLayout> | ||||||
|  |     </LinearLayout> | ||||||
|  | </ScrollView> | ||||||
| @@ -1,6 +1,10 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <menu xmlns:android="http://schemas.android.com/apk/res/android" | <menu xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|       xmlns:app="http://schemas.android.com/apk/res-auto"> |       xmlns:app="http://schemas.android.com/apk/res-auto"> | ||||||
|  |     <item | ||||||
|  |         android:id="@+id/settings" | ||||||
|  |         android:title="@string/settings" | ||||||
|  |         app:showAsAction="never"/> | ||||||
|     <item |     <item | ||||||
|         android:id="@+id/about" |         android:id="@+id/about" | ||||||
|         android:title="@string/about" |         android:title="@string/about" | ||||||
|   | |||||||
| @@ -2,4 +2,5 @@ | |||||||
|     <dimen name="activity_margin">16dp</dimen> |     <dimen name="activity_margin">16dp</dimen> | ||||||
|     <dimen name="social_padding">8dp</dimen> |     <dimen name="social_padding">8dp</dimen> | ||||||
|     <dimen name="social_logo">40dp</dimen> |     <dimen name="social_logo">40dp</dimen> | ||||||
|  |     <dimen name="settings_padding">8dp</dimen> | ||||||
| </resources> | </resources> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user