From d0ca08391b02aa4ed75928d8bece74d674e09e24 Mon Sep 17 00:00:00 2001 From: Matthieu <61561059+Wv5twkFEKh54vo4tta9yu7dHa3@users.noreply.github.com> Date: Fri, 6 Mar 2020 08:49:26 +0100 Subject: [PATCH] Add button to main activity to start a login process --- app/src/main/AndroidManifest.xml | 2 +- .../h/pixeldroid/{Login.kt => LoginActivity.kt} | 2 +- .../main/java/com/h/pixeldroid/MainActivity.kt | 16 +++++++--------- app/src/main/res/layout/activity_login.xml | 2 +- app/src/main/res/layout/activity_main.xml | 10 ++++++++++ 5 files changed, 20 insertions(+), 12 deletions(-) rename app/src/main/java/com/h/pixeldroid/{Login.kt => LoginActivity.kt} (98%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 82b927ac..8770fc6d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,7 +11,7 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/app/src/main/java/com/h/pixeldroid/Login.kt b/app/src/main/java/com/h/pixeldroid/LoginActivity.kt similarity index 98% rename from app/src/main/java/com/h/pixeldroid/Login.kt rename to app/src/main/java/com/h/pixeldroid/LoginActivity.kt index 82622401..ddd2f943 100644 --- a/app/src/main/java/com/h/pixeldroid/Login.kt +++ b/app/src/main/java/com/h/pixeldroid/LoginActivity.kt @@ -16,7 +16,7 @@ import retrofit2.Call import retrofit2.Callback import retrofit2.Response -class Login : AppCompatActivity() { +class LoginActivity : AppCompatActivity() { private lateinit var preferences: SharedPreferences diff --git a/app/src/main/java/com/h/pixeldroid/MainActivity.kt b/app/src/main/java/com/h/pixeldroid/MainActivity.kt index 4631f819..4e2bb2aa 100644 --- a/app/src/main/java/com/h/pixeldroid/MainActivity.kt +++ b/app/src/main/java/com/h/pixeldroid/MainActivity.kt @@ -1,22 +1,20 @@ package com.h.pixeldroid +import android.content.Intent import androidx.appcompat.app.AppCompatActivity import android.os.Bundle -import android.util.Log -import com.h.pixeldroid.api.PixelfedAPI -import com.h.pixeldroid.objects.Status -import retrofit2.Call -import retrofit2.Callback -import retrofit2.Response -import retrofit2.Retrofit -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory -import retrofit2.converter.gson.GsonConverterFactory +import android.view.View +import android.widget.Button class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + val button = findViewById