mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
commit
5b8e255a7e
@ -18,7 +18,7 @@ public class Requestor {
|
|||||||
String apiKey;
|
String apiKey;
|
||||||
OkHttpClient client;
|
OkHttpClient client;
|
||||||
|
|
||||||
Requestor(AuthManager authManager, String apiKey) {
|
public Requestor(AuthManager authManager, String apiKey) {
|
||||||
this.authManager = authManager;
|
this.authManager = authManager;
|
||||||
this.apiKey = apiKey;
|
this.apiKey = apiKey;
|
||||||
client = new OkHttpClient();
|
client = new OkHttpClient();
|
||||||
|
|||||||
@ -10,7 +10,18 @@ import android.view.LayoutInflater;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import static com.example.listify.MainActivity.am;
|
||||||
|
|
||||||
|
import com.example.listify.AuthManager;
|
||||||
|
import com.example.listify.MainActivity;
|
||||||
import com.example.listify.R;
|
import com.example.listify.R;
|
||||||
|
import com.example.listify.Requestor;
|
||||||
|
import com.example.listify.ui.LoginPage;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class HomeFragment extends Fragment {
|
public class HomeFragment extends Fragment {
|
||||||
private Button toLoginPage;
|
private Button toLoginPage;
|
||||||
@ -23,7 +34,7 @@ public class HomeFragment extends Fragment {
|
|||||||
toLoginPage.setOnClickListener(new View.OnClickListener() {
|
toLoginPage.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.LoginPage.class);
|
Intent intent = new Intent(getActivity(), com.example.listify.ui.LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -32,8 +43,20 @@ public class HomeFragment extends Fragment {
|
|||||||
toListPage.setOnClickListener(new View.OnClickListener() {
|
toListPage.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ListPage.class);
|
//Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ListPage.class);
|
||||||
startActivity(intent);
|
//startActivity(intent);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Properties configs = new Properties();
|
||||||
|
try {
|
||||||
|
configs = AuthManager.loadProperties(getContext(), "android.resource://" + getActivity().getPackageName() + "/raw/auths.json");
|
||||||
|
} catch (IOException | JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
|
||||||
|
am.deleteUser(requestor);
|
||||||
|
}
|
||||||
|
catch(Exception ex) {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -11,17 +11,17 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="25dp"
|
android:layout_marginBottom="25dp"
|
||||||
android:layout_marginStart="1dp"
|
android:layout_marginEnd="25dp"
|
||||||
android:text="Log in"
|
android:text="Log in"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/button2"
|
app:layout_constraintBottom_toTopOf="@+id/button2"
|
||||||
app:layout_constraintStart_toStartOf="@+id/button2" />
|
app:layout_constraintEnd_toEndOf="@+id/button2" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/button2"
|
android:id="@+id/button2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="148dp"
|
android:layout_marginBottom="148dp"
|
||||||
android:text="List"
|
android:text="Delete Account"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user