added about fragment

This commit is contained in:
Bryson Steck 2021-05-08 18:01:47 -06:00
parent fc908199f1
commit 2c540ef7ce
28 changed files with 80 additions and 33 deletions

View file

@ -0,0 +1,18 @@
package me.brysonsteck.wiimmfiwatcher;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class AboutFragment extends Fragment {
public AboutFragment() { super(R.layout.about_fragment); }
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
}

View file

@ -1,7 +1,9 @@
package me.brysonsteck.wiimmfiwatcher;
import android.content.ClipData;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.ObservableArrayList;
@ -15,18 +17,6 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// FragmentContainerView fcInput = findViewById(R.id.room_fragment);
// this.database = Room.databaseBuilder(this, AppDatabase.class, "friend-codes-db").build();
// new Thread(() -> {
// try {
// Thread.sleep(1000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// recentFCList.addAll(database.getFriendCodeDao().getAll());
// }).start();
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
@ -37,5 +27,15 @@ public class MainActivity extends AppCompatActivity {
}
setContentView(R.layout.activity_main);
View aboutButton = findViewById(R.id.about_button);
aboutButton.setOnClickListener((about) -> {
getSupportFragmentManager().beginTransaction()
.replace(R.id.friend_code_input_fragment, new AboutFragment(), null)
.setReorderingAllowed(true)
.addToBackStack(null)
.commit();
});
}
}

View file

@ -12,20 +12,20 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.button.MaterialButton;
import java.util.ArrayList;
import me.brysonsteck.wiimmfiwatcher.model.FriendCode;
import me.brysonsteck.wiimmfiwatcher.wiimmfi.WiimmfiActivity;
public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.ViewHolder>{
ObservableArrayList<FriendCode> entries;
OnFriendCodeClicked listener;
Context context;
public interface OnFriendCodeClicked {
public void onClick(FriendCode entry);
}
ArrayList<String> recentCodes;
public WatchCodeAdapter(Context context, ObservableArrayList<FriendCode> entries) {
this.context = context;
this.entries = entries;
this.recentCodes = new ArrayList<>();
}
@NonNull
@ -37,16 +37,17 @@ public class WatchCodeAdapter extends RecyclerView.Adapter<WatchCodeAdapter.View
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
String currentFC = entries.get(position).friendCode;
MaterialButton fcButton = holder.itemView.findViewById(R.id.recent_friend_code_button);
FriendCode currentFC = entries.get(position);
fcButton.setText(currentFC.friendCode);
fcButton.setText(currentFC);
fcButton.setOnClickListener(view -> {
Intent intent = new Intent(view.getContext(), WiimmfiActivity.class);
intent.putExtra("friendCode", currentFC.friendCode);
context.startActivity(intent);
Intent intent = new Intent(view.getContext(), WiimmfiActivity.class);
intent.putExtra("friendCode", currentFC);
context.startActivity(intent);
});
}
@Override
public int getItemCount() {
return entries.size();

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="About Wiimmfi Watcher"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/about_me_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="TextView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView" />
<TextView
android:id="@+id/textView5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="About Me"
android:textSize="30sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/about_me_text" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -27,7 +27,7 @@
android:background="@android:color/transparent"
android:elevation="0dp"
app:menu="@menu/top_app_bar"
app:title="Wiimmfi Friend Codes" />
app:title="Wiimmfi Watcher" />
</com.google.android.material.appbar.AppBarLayout>

View file

@ -2,7 +2,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/favorite"
android:id="@+id/about_button"
android:icon="@drawable/ic_baseline_info_24"
android:title="About"
app:showAsAction="ifRoom" />

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/wiimmterface_launcher_background"/>
<foreground android:drawable="@mipmap/wiimmterface_launcher_foreground"/>
</adaptive-icon>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/wiimmterface_launcher_background"/>
<foreground android:drawable="@mipmap/wiimmterface_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB