Skip to content

Commit

Permalink
Added second activity
Browse files Browse the repository at this point in the history
  • Loading branch information
km2442 committed May 5, 2019
1 parent b147542 commit 4ef8d13
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 34 deletions.
3 changes: 2 additions & 1 deletion Android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Built application files
/*/build/
/app/*
/build/*

# Crashlytics configuations
com_crashlytics_export_strings.xml
Expand Down
Binary file modified Android/.idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified Android/.idea/caches/gradle_models.ser
Binary file not shown.
5 changes: 3 additions & 2 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "dev.kamilklecha.autoswitchmobile"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionCode 2
versionName '1.0.0.1'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -16,6 +16,7 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion = '28.0.3'
}

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".Settings"
android:label="@string/title_activity_settings">
</activity>
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package dev.kamilklecha.autoswitchmobile;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.v4.view.GravityCompat;
import android.support.v7.app.ActionBarDrawerToggle;
import android.view.MenuItem;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;

import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {

Button btn;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -38,6 +40,15 @@ public void onClick(View view) {
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView.setNavigationItemSelectedListener(this);
btn = findViewById(R.id.Main_btn);
View.OnClickListener cl = new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MainActivity.this, Settings.class);
startActivity(i);
}
};
btn.setOnClickListener(cl);
}

@Override
Expand All @@ -50,28 +61,6 @@ public void onBackPressed() {
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
Expand Down
4 changes: 2 additions & 2 deletions Android/app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
android:layout_marginEnd="16dp"
android:layout_marginBottom="100dp"
android:text="@string/home_welcome"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintBottom_toTopOf="@+id/Main_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView3" />

<Button
android:id="@+id/button"
android:id="@+id/Main_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
Expand Down
3 changes: 2 additions & 1 deletion Android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">AutoSwitch Mobile</string>
<string name="title_activity_main">MainActivity</string>
<string name="title_activity_main">AutoSwitch for android</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">AutoSwitch Mobile</string>
Expand All @@ -14,4 +14,5 @@
<string name="nav_header_subtitle">[email protected]</string>
<string name="home_welcome">Welcome in AutoSwitch Mobile!</string>
<string name="home_next_screen">Go to PC control</string>
<string name="title_activity_settings">Settings</string>
</resources>

0 comments on commit 4ef8d13

Please sign in to comment.