Skip to content

Commit

Permalink
update for v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RichadoWonosas committed Apr 19, 2021
1 parent 46fd0ae commit 78f9691
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 34 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 1
versionName "1.0"
versionCode 2
versionName 'v1.0.1'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
1 change: 0 additions & 1 deletion app/release/output.json

This file was deleted.

Binary file removed app/release/slsteditor_1_0.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import org.json.JSONException;
Expand Down Expand Up @@ -105,6 +106,11 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
infoDialog.show();

((ImageView) infoDialogView.findViewById(R.id.imageAuthor)).setImageResource(R.drawable.author);
try {
((TextView) infoDialogView.findViewById(R.id.descriptionVersion)).setText(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
} catch (Exception e) {
((TextView) infoDialogView.findViewById(R.id.descriptionVersion)).setText("");
}

infoDialogView.findViewById(R.id.infoFinishButton).setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,75 @@
package ap.yadora.richadowonosas.fmdslst.container;

import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TableRow;
import android.widget.TextView;

import java.math.BigInteger;

import ap.yadora.richadowonosas.fmdslst.R;

final class DifficultyContainer {
private final View root;
private final Button expandButton;
private final TextView title;
private final TextView title, contentDifficulty;
private final SingleContainer chartDesigner, jacketDesigner, rating, jacketNight, bg;
private final CheckContainer enabled, ratingPlus, jacketOverride, hiddenUntilUnlocked, worldUnlock;
private boolean isExpanded, isAvailable, isVisible;
private int checkHeight, partsHeight, textHeight, rarePartsHeight, rareTextHeight;
private int partsHeight, textHeight, rarePartsHeight, rareTextHeight;
private final int HEIGHT_PARTS;

public DifficultyContainer(View view, int rootId) {
root = view.findViewById(rootId);
HEIGHT_PARTS = (int) root.getResources().getDimension(R.dimen.height_parts);
checkHeight = partsHeight = textHeight = 0;
partsHeight = textHeight = 0;

title = root.findViewById(R.id.editTitleDifficulty);
expandButton = root.findViewById(R.id.editButtonExpandDifficulty);
contentDifficulty = root.findViewById(R.id.contentDifficulty);
enabled = new CheckContainer(root, R.id.editAvailable);
expandButton = root.findViewById(R.id.editButtonExpandDifficulty);

chartDesigner = new SingleContainer(root, R.id.editChartDesigner, SingleContainer.TYPE_MULTILINE_TEXT);
jacketDesigner = new SingleContainer(root, R.id.editJacketDesigner, SingleContainer.TYPE_MULTILINE_TEXT);
rating = new SingleContainer(root, R.id.editRating, SingleContainer.TYPE_INTEGER);
rating = new SingleContainer(root, R.id.editRating, SingleContainer.TYPE_SIGNED);
ratingPlus = new CheckContainer(root, R.id.editRatingPlus);
jacketNight = new SingleContainer(root, R.id.editJacketNight, SingleContainer.TYPE_PLAIN_TEXT);
jacketOverride = new CheckContainer(root, R.id.editJacketOverride);
hiddenUntilUnlocked = new CheckContainer(root, R.id.editHiddenUntilUnlocked);
bg = new SingleContainer(root, R.id.editBackground, SingleContainer.TYPE_PLAIN_TEXT);
worldUnlock = new CheckContainer(root, R.id.editWorldUnlock);

View.OnFocusChangeListener onFocusChangeListener = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
refresh();
}
};

View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
refresh();
}
};

isExpanded = isAvailable = false;
expandButton.setText(R.string.selection_expand);
enabled.getContent().setChecked(false);
enabled.getContent().setOnClickListener(onClickListener);
enabled.getTitle().setText(R.string.info_difficulty_enable);
chartDesigner.getContent().setEnabled(false);
chartDesigner.getTitle().setText(R.string.info_difficulty_chart_designer);
jacketDesigner.getContent().setEnabled(false);
jacketDesigner.getTitle().setText(R.string.info_difficulty_jacket_designer);
rating.getContent().setEnabled(false);
rating.getContent().setOnFocusChangeListener(onFocusChangeListener);
rating.getTitle().setText(R.string.info_difficulty_rating);
ratingPlus.getContent().setClickable(false);
ratingPlus.getTitle().setText(R.string.info_difficulty_rating_plus);
ratingPlus.getContent().setOnClickListener(onClickListener);
jacketNight.getContent().setEnabled(false);
jacketNight.getTitle().setText(R.string.info_difficulty_jacket_night);
jacketOverride.getContent().setClickable(false);
Expand All @@ -62,13 +81,6 @@ public DifficultyContainer(View view, int rootId) {
worldUnlock.getContent().setClickable(false);
worldUnlock.getTitle().setText(R.string.info_world_unlock);

enabled.getContent().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
refresh();
}
});

expandButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -88,11 +100,12 @@ private void setHeight(View view, int height) {

public void refresh() {
isAvailable = enabled.getContent().isChecked();
textHeight = partsHeight = rareTextHeight = rarePartsHeight = 0;
isExpanded = isExpanded & isAvailable;
textHeight = partsHeight = rareTextHeight = rarePartsHeight = 0;

if (isExpanded) {
expandButton.setText(R.string.selection_collapse);
checkHeight = HEIGHT_PARTS;
expandButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, root.getContext().getDrawable(R.drawable.icon_normal_expand), null);
if (isAvailable) {
textHeight = ViewGroup.LayoutParams.WRAP_CONTENT;
partsHeight = HEIGHT_PARTS;
Expand All @@ -103,7 +116,19 @@ public void refresh() {
}
} else {
expandButton.setText(R.string.selection_expand);
checkHeight = 0;
expandButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, root.getContext().getDrawable(R.drawable.icon_normal_collapse), null);
}

if (!isAvailable) {
contentDifficulty.setText(R.string.default_song_difficulty);
} else {
if (!isExpanded) {
if (rating.getContent().getText().length() == 0) {
rating.getContent().setText("0");
}
}
int diff = new BigInteger(rating.getContent().getText().toString()).intValue();
contentDifficulty.setText(((diff == 0) ? "?" : diff) + ((ratingPlus.getContent().isChecked()) ? "+" : ""));
}

chartDesigner.getContent().setEnabled(isAvailable);
Expand All @@ -116,7 +141,6 @@ public void refresh() {
bg.getContent().setEnabled(isAvailable && isVisible);
worldUnlock.getContent().setClickable(isAvailable && isVisible);

setHeight(enabled.getRoot(), checkHeight);
setHeight(chartDesigner.getRoot(), textHeight);
setHeight(jacketDesigner.getRoot(), textHeight);
setHeight(rating.getRoot(), textHeight);
Expand All @@ -128,6 +152,12 @@ public void refresh() {
setHeight(worldUnlock.getRoot(), rarePartsHeight);
}

private void setWeight(View view, float weight) {
TableRow.LayoutParams layoutParams = new TableRow.LayoutParams(view.getLayoutParams());
layoutParams.weight = weight;
view.setLayoutParams(layoutParams);
}

public View getRoot() {
return root;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ final class SingleContainer {
public static final int TYPE_PLAIN_TEXT = 0;
public static final int TYPE_MULTILINE_TEXT = 1;
public static final int TYPE_INTEGER = 2;
public static final int TYPE_DECIMAL = 3;
public static final int TYPE_SIGNED = 3;
public static final int TYPE_DECIMAL = 4;

private final int type;
private final View root;
Expand All @@ -35,6 +36,8 @@ public SingleContainer(View view, int rootId, int type) {
break;
case TYPE_INTEGER:
content.setInputType(InputType.TYPE_CLASS_NUMBER);
case TYPE_SIGNED:
content.setInputType(InputType.TYPE_CLASS_NUMBER ^ InputType.TYPE_NUMBER_FLAG_SIGNED);
break;
case TYPE_DECIMAL:
content.setInputType(InputType.TYPE_CLASS_NUMBER ^ InputType.TYPE_NUMBER_FLAG_DECIMAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public SongInfo getSongInfo() {
difficulty.setRatingClass(i);
difficulty.setChartDesigner(difficulties[i].getChartDesigner().getContent().getText().toString());
difficulty.setJacketDesigner(difficulties[i].getJacketDesigner().getContent().getText().toString());
difficulty.setRating(new BigInteger(difficulties[i].getRating().getContent().getText().toString()).intValue());
difficulty.setRating((difficulties[i].getRating().getContent().getText().length() == 0) ? 0 : (new BigInteger(difficulties[i].getRating().getContent().getText().toString()).intValue()));
difficulty.setRatingPlus(difficulties[i].getRatingPlus().getContent().isChecked());
difficulty.setJacket_night((difficulties[i].getJacketNight().getContent().getText().length() == 0) ? null : difficulties[i].getJacketNight().getContent().getText().toString());
difficulty.setJacketOverride(difficulties[i].getJacketOverride().getContent().isChecked());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
songIdString = "(id: " + Songlist.songlist.getSongInfoById(songIds[position]).getId() + ")";
holder.getSongIdPreview().setText(songIdString);

File imageFile = new File(SelectSongActivity.SONGS_DIRECTORY, songIds[position] + "/base.jpg");
File imageFile = new File(Songlist.songlist.getSonglistFileParent(), songIds[position] + "/base.jpg");
if (imageFile.canRead()) {
holder.getSongCoverPreview().setImageURI(Uri.fromFile(imageFile));
}
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/icon_normal_collapse.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,16.52l-7.06,-7.06 1.42,-1.42 5.64,5.64 5.64,-5.64 1.42,1.42z"/>
</vector>
35 changes: 35 additions & 0 deletions app/src/main/res/layout/content_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,41 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/titleVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="8dp"
android:text="@string/title_info_version"
android:textColor="@color/tairitsuLight"
android:textStyle="bold" />

<TextView
android:id="@+id/descriptionVersion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:lineSpacingExtra="4sp"
android:textAlignment="textStart"
android:textColor="@android:color/primary_text_light"
android:textSize="16sp" />

<View
android:id="@+id/divider4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="24dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="2dp"
android:background="@color/tairitsuLight" />

<TextView
android:id="@+id/titleUsage"
android:layout_width="match_parent"
Expand Down
39 changes: 28 additions & 11 deletions app/src/main/res/layout/content_edit_difficulty.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,36 @@
android:inputType="textPersonName"
android:orientation="vertical">

<Button
android:id="@+id/editButtonExpandDifficulty"
<TableRow
android:layout_width="match_parent"
android:layout_height="45sp"
android:backgroundTint="@color/tairitsuLight"
android:minHeight="45sp"
android:textColor="@android:color/white" />
android:layout_height="match_parent" >

<include
android:id="@+id/editAvailable"
layout="@layout/content_edit_check"
android:layout_width="match_parent"
android:layout_height="45sp" />
<TextView
android:id="@+id/contentDifficulty"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/default_song_difficulty"
android:textColor="@color/tairitsuLight" />

<include
android:id="@+id/editAvailable"
layout="@layout/content_edit_check"
android:layout_width="wrap_content"
android:layout_height="45sp" />

<Button
android:id="@+id/editButtonExpandDifficulty"
android:layout_width="0dp"
android:layout_height="45sp"
android:layout_weight="1"
android:backgroundTint="@color/tairitsuLight"
android:drawableEnd="@drawable/icon_normal_collapse"
android:lines="1"
android:minHeight="45sp"
android:textColor="@android:color/white" />
</TableRow>

<include
android:id="@+id/editChartDesigner"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ja-rJP/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@
<string name="title_author">作者</string>
<string name="title_introduction">紹介</string>
<string name="description_usage">当アプリケーションは、ストレージにあるsonglistファイルの読み込みができ、その中のソングインフォの編集や新規作成、導入導出、削除などの操作もできる。ARCFMDと一緒に使うことを推奨。</string>
<string name="default_song_difficulty">利用不可</string>
<string name="title_info_version">アプリケーションバージョン</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,6 @@
<string name="title_author">作者</string>
<string name="title_introduction">简介</string>
<string name="description_usage">本应用能够读入存储空间中的songlist文件,并支持对其曲目信息的编辑、新增、导入、导出、删除等操作。推荐与ARCFMD应用配套使用。</string>
<string name="default_song_difficulty">未启用</string>
<string name="title_info_version">应用程序版本</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@
<string name="info_author" translatable="false">RichadoWonosas</string>
<string name="title_introduction">Introduction</string>
<string name="description_usage">This application can read songlist file in the storage and allows operations to its song infos such as editing, creating, importing and exporting, delete, etc. It is recommended to use with ARCFMD application.</string>
<string name="default_song_difficulty">Unavailable</string>
<string name="title_info_version">Application Version</string>
</resources>

0 comments on commit 78f9691

Please sign in to comment.