Skip to content

add readme file #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file added .gradle/5.4.1/fileContent/fileContent.lock
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/5.4.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file added .gradle/5.4.1/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file added .gradle/5.4.1/javaCompile/classAnalysis.bin
Binary file not shown.
Binary file added .gradle/5.4.1/javaCompile/javaCompile.lock
Binary file not shown.
Binary file added .gradle/5.4.1/javaCompile/taskHistory.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
Binary file modified .idea/caches/gradle_models.ser
Binary file not shown.
14 changes: 14 additions & 0 deletions .idea/libraries/Gradle__com_android_volley_volley_1_1_1_aar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

343 changes: 277 additions & 66 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# AndroidWeatherApp

3 changes: 2 additions & 1 deletion app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
</configuration>
Expand Down Expand Up @@ -135,5 +135,6 @@
<orderEntry type="library" name="Gradle: androidx.arch.core:core-runtime:2.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.interpolator:interpolator:1.0.0@aar" level="project" />
<orderEntry type="library" name="Gradle: androidx.constraintlayout:constraintlayout:1.1.3@aar" level="project" />
<orderEntry type="library" name="Gradle: com.android.volley:volley:1.1.1@aar" level="project" />
</component>
</module>
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.volley:volley:1.1.1'

}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tees.ac.uk.a0321466.weatherapp">
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,39 @@

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity {

LinearLayout city_finder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

city_finder= findViewById(R.id.cityFinder);
city_finder.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){

Intent i = new Intent(getApplicationContext(),cityFinder.class);
startActivity(i);
//Toast.makeText(MainActivity.this,"button press",Toast.LENGTH_SHORT).show();
}
});

Intent g= getIntent();
String city= g.getStringExtra("city");
if(city !=null){
Toast.makeText(MainActivity.this, "search :" + city,Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(MainActivity.this, "sorry you entered empty value", Toast.LENGTH_SHORT).show();
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.tees.ac.uk.a0321466.weatherapp;

class activity_city_finder {
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,54 @@

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;

public class cityFinder extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_city_finder);

//back button event
((ImageView)findViewById(R.id.goBack)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handleActivity(""); //go back without data (pass "" to mainActivity)
}
});

//cancel button
((Button)findViewById(R.id.btnCancel)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
handleActivity(""); //send empty string data
}
});
//ok button
((Button)findViewById(R.id.btnOk)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText edCity=findViewById(R.id.searchCity);
handleActivity(edCity.getText().toString()); //pass enterted city name
}
});
}

// pass data from activity_city_finder to main activity
private void handleActivity(String s){
Intent i = new Intent(getApplicationContext(),MainActivity.class);
if(s !=""){
i.putExtra("city",s);
}
else {
i.putExtra("city", "");
}
startActivity(i);
}
}
56 changes: 44 additions & 12 deletions app/src/main/res/layout/activity_city_finder.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
android:background="#222343"
tools:context=".cityFinder">

<!-- back button with image icon -->

<ImageView
android:layout_width="wrap_content"
Expand All @@ -19,22 +20,53 @@

</ImageView>

<EditText
<!-- vertical align linear layout having editText and linear layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="enter city name"
android:textColor="#000000"
android:textSize="30sp"
android:orientation="vertical"
android:layout_centerInParent="true"
android:gravity="center_vertical|center_horizontal"
android:inputType="textAutoCorrect"
android:imeOptions="actionGo"
android:background="@drawable/inputboxstyle"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:id="@+id/searchCity"
>

</EditText>

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="enter city name"
android:textColor="#000000"
android:textSize="30sp"
android:layout_centerInParent="true"
android:gravity="center_vertical|center_horizontal"
android:inputType="textAutoCorrect"
android:imeOptions="actionGo"
android:background="@drawable/inputboxstyle"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:id="@+id/searchCity"
>
</EditText>

<!-- add cancel and ok button in linear layout -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="right"
android:layout_marginTop="10dp"
android:layout_marginEnd="32dp"
>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginRight="3dp"
android:text="OK"
android:id="@+id/btnOk"/>
<Button
android:layout_width="100dp"
android:layout_height="match_parent"
android:text="CANCEL"
android:id="@+id/btnCancel"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
3 changes: 1 addition & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
android:layout_marginTop="30dp"
android:src="@drawable/finding"


>

</ImageView>
Expand Down Expand Up @@ -90,7 +89,7 @@
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="25sp"
android:layout_gravity="center_vertical"

android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textStyle="bold"
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'


// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down