Skip to content

Commit

Permalink
update for v1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RichadoWonosas committed May 16, 2021
1 parent 03c3d52 commit 277e53f
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 60 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "ap.yadora.richadowonosas.fmdslst"
minSdkVersion 21
targetSdkVersion 30
versionCode 4
versionName 'v1.0.3'
versionCode 5
versionName 'v1.0.4'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.LicenseActivity"
android:label="@string/title_license"
android:theme="@style/AppTheme.NoActionBar" ></activity>
<activity
android:name=".activity.SongInfoEditActivity"
android:label="@string/title_edit_song"
Expand All @@ -20,9 +23,10 @@
android:name=".activity.SelectSongActivity"
android:label="@string/title_activity_select_song"
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".activity.MainActivity"
<activity
android:name=".activity.MainActivity"
android:label="@string/title_app_name"
android:theme="@style/AppTheme.NoActionBar" >
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ap.yadora.richadowonosas.fmdslst.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import ap.yadora.richadowonosas.fmdslst.R;

public class LicenseActivity extends AppCompatActivity {

private Toolbar toolbar;
private TextView licenseText;

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

bindViews();

setSupportActionBar(toolbar);
setLicenseText();
}

private void bindViews() {
toolbar = findViewById(R.id.toolbarLicense);
licenseText = findViewById(R.id.licenseContent);
}

private void setLicenseText() {
licenseText.setText(getText(R.string.content_license));
}

public void onClickBackButton(View view) {
finish();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public void onSelectSonglist(View view) {
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(Intent.createChooser(intent, getResources().getString(R.string.title_choose_songlist)), CODE_FIND_SONGLIST);
return;
}

public void onCheckLicense(View view) {
startActivity(new Intent(this, LicenseActivity.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ public void onWindowFocusChanged(boolean hasFocus) {

private void setUpRecyclerView() {
recyclerView.setLayoutManager(new LinearLayoutManager(this));
songInfoAdapter.bindColour(this);
songInfoAdapter.setOnItemClickListener(new SongInfoAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ap.yadora.richadowonosas.fmdslst.util;

import android.content.Context;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Handler;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -29,6 +31,8 @@ public final class SongInfoAdapter extends RecyclerView.Adapter<SongInfoAdapter.
private int sortCriterion;
private boolean isAscend;

private int colourTairitsu, colourHikari;

public SongInfoAdapter(int sortFactor, boolean isAscend) {
this.sortCriterion = sortFactor;
this.isAscend = isAscend;
Expand Down Expand Up @@ -95,6 +99,19 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
}
}

int colour;
switch (Songlist.songlist.getSongInfoById(songIds[position]).getSide()) {
default:
case 0:
colour = colourHikari;
break;
case 1:
colour = colourTairitsu;
break;
}

holder.getSideShader().setImageTintList(ColorStateList.valueOf(colour));

holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -139,6 +156,11 @@ public int getItemCount() {
return Songlist.songlist.getSongAmount();
}

public void bindColour(Context content) {
colourTairitsu = content.getResources().getColor(R.color.tairitsuLight);
colourHikari = content.getResources().getColor(R.color.hikariLight);
}

public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
this.onItemClickListener = onItemClickListener;
}
Expand All @@ -165,6 +187,7 @@ public static class ViewHolder extends RecyclerView.ViewHolder {
private final ImageView songCoverPreview;
private final TextView songTitlePreview;
private final TextView songIdPreview;
private final ImageView sideShader;
private boolean isTouching = false;

public ViewHolder(@NonNull View itemView) {
Expand All @@ -173,6 +196,7 @@ public ViewHolder(@NonNull View itemView) {
songCoverPreview = itemView.findViewById(R.id.songCoverPreview);
songTitlePreview = itemView.findViewById(R.id.songTitlePreview);
songIdPreview = itemView.findViewById(R.id.songIdPreview);
sideShader = itemView.findViewById(R.id.sideShader);

final Handler handler = new Handler();
handler.post(new Runnable() {
Expand Down Expand Up @@ -209,5 +233,9 @@ public TextView getSongTitlePreview() {
public TextView getSongIdPreview() {
return songIdPreview;
}

public ImageView getSideShader() {
return sideShader;
}
}
}
56 changes: 56 additions & 0 deletions app/src/main/res/layout/activity_license.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.LicenseActivity">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/tairitsuLight"
android:backgroundTint="@color/tairitsuLight"
android:theme="@style/AppTheme.AppBarOverlay">

<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">

<ImageButton
android:id="@+id/licenseBackButton"
style="@style/Widget.AppCompat.ImageButton"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:backgroundTint="@color/tairitsuLight"
android:clickable="true"
android:contentDescription="@string/selection_back"
android:focusable="true"
android:onClick="onClickBackButton"
android:padding="12dp"
android:scaleType="centerCrop"
android:theme="@style/Ripple"
app:srcCompat="@drawable/icon_normal_back" />

<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbarLicense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:theme="?attr/actionBarTheme" />

</TableRow>

</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/content_license" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
58 changes: 38 additions & 20 deletions app/src/main/res/layout/content_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="300dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp">

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -55,7 +57,7 @@
android:textSize="16sp" />

<View
android:id="@+id/divider4"
android:id="@+id/divider3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="24dp"
Expand Down Expand Up @@ -91,7 +93,7 @@
android:textSize="16sp" />

<View
android:id="@+id/divider3"
android:id="@+id/divider4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="24dp"
Expand Down Expand Up @@ -135,24 +137,40 @@
android:textColor="@color/tairitsuLight"
android:textStyle="bold|italic" />

<Button
android:id="@+id/infoFinishButton"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="20dp"
android:background="#ffffff"
android:backgroundTint="#ffffff"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical|end"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="@string/selection_finish"
android:textColor="@color/tairitsuLight" />

</LinearLayout>
</ScrollView>

<Button
android:id="@+id/checkLicenseButton"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="16dp"
android:background="#ffffff"
android:backgroundTint="#ffffff"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical|start"
android:onClick="onCheckLicense"
android:padding="4dp"
android:text="@string/selection_check_licence"
android:textColor="@color/tairitsuLight" />

<Button
android:id="@+id/infoFinishButton"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginEnd="16dp"
android:background="#ffffff"
android:backgroundTint="#ffffff"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical|end"
android:padding="4dp"
android:text="@string/selection_finish"
android:textColor="@color/tairitsuLight" />

</LinearLayout>
36 changes: 36 additions & 0 deletions app/src/main/res/layout/content_license.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".activity.LicenseActivity"
tools:showIn="@layout/activity_license">

<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">

<TextView
android:id="@+id/licenseContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:scrollbars="vertical"
android:textAlignment="viewStart"
android:textSize="14sp"
android:typeface="normal" />
</ScrollView>

<Button
android:id="@+id/licenseConfirmButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="@color/tairitsuLight"
android:onClick="onClickBackButton"
android:text="@string/title_confirm"
android:textColor="@android:color/white" />
</LinearLayout>
Loading

0 comments on commit 277e53f

Please sign in to comment.