Skip to content

Commit

Permalink
v0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
tateisu committed May 3, 2017
1 parent f0411b1 commit 431d6f3
Show file tree
Hide file tree
Showing 86 changed files with 1,429 additions and 735 deletions.
Binary file added _ArtWork/ic_follow_cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ArtWork/ic_follow_cross_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ArtWork/ic_follow_plus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ArtWork/ic_follow_plus_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ArtWork/ic_followed_by.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _ArtWork/ic_followed_by_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "jp.juggler.subwaytooter"
minSdkVersion 21
targetSdkVersion 25
versionCode 32
versionName "0.3.2"
versionCode 33
versionName "0.3.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
64 changes: 48 additions & 16 deletions app/src/main/java/jp/juggler/subwaytooter/ActAccountSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

public class ActAccountSetting extends AppCompatActivity
implements View.OnClickListener
, CompoundButton.OnCheckedChangeListener
{
, CompoundButton.OnCheckedChangeListener {

static final LogCategory log = new LogCategory( "ActAccountSetting" );

Expand Down Expand Up @@ -64,7 +63,7 @@ protected void onCreate( @Nullable Bundle savedInstanceState ){
static final int REQUEST_CODE_ACCT_CUSTOMIZE = 1;

@Override protected void onActivityResult( int requestCode, int resultCode, Intent data ){
if( requestCode== REQUEST_CODE_ACCT_CUSTOMIZE && resultCode == RESULT_OK ){
if( requestCode == REQUEST_CODE_ACCT_CUSTOMIZE && resultCode == RESULT_OK ){
showAcctColor();
}
super.onActivityResult( requestCode, resultCode, data );
Expand All @@ -75,14 +74,19 @@ protected void onCreate( @Nullable Bundle savedInstanceState ){
View btnAccessToken;
View btnAccountRemove;
Button btnVisibility;
Switch swConfirmBeforeBoost;
Switch swNSFWOpen;
Button btnOpenBrowser;
CheckBox cbNotificationMention;
CheckBox cbNotificationBoost;
CheckBox cbNotificationFavourite;
CheckBox cbNotificationFollow;

CheckBox cbConfirmFollow;
CheckBox cbConfirmFollowLockedUser;
CheckBox cbConfirmUnfollow;
CheckBox cbConfirmBoost;
CheckBox cbConfirmToot;

TextView tvUserCustom;
View btnUserCustom;
String full_acct;
Expand All @@ -94,14 +98,19 @@ private void initUI(){
btnAccessToken = findViewById( R.id.btnAccessToken );
btnAccountRemove = findViewById( R.id.btnAccountRemove );
btnVisibility = (Button) findViewById( R.id.btnVisibility );
swConfirmBeforeBoost = (Switch) findViewById( R.id.swConfirmBeforeBoost );
swNSFWOpen = (Switch) findViewById( R.id.swNSFWOpen );
btnOpenBrowser = (Button) findViewById( R.id.btnOpenBrowser );
cbNotificationMention = (CheckBox) findViewById( R.id.cbNotificationMention );
cbNotificationBoost = (CheckBox) findViewById( R.id.cbNotificationBoost );
cbNotificationFavourite = (CheckBox) findViewById( R.id.cbNotificationFavourite );
cbNotificationFollow = (CheckBox) findViewById( R.id.cbNotificationFollow );


cbConfirmFollow = (CheckBox) findViewById( R.id.cbConfirmFollow );
cbConfirmFollowLockedUser = (CheckBox) findViewById( R.id.cbConfirmFollowLockedUser );
cbConfirmUnfollow = (CheckBox) findViewById( R.id.cbConfirmUnfollow );
cbConfirmBoost = (CheckBox) findViewById( R.id.cbConfirmBoost );
cbConfirmToot = (CheckBox) findViewById( R.id.cbConfirmToot );

tvUserCustom = (TextView) findViewById( R.id.tvUserCustom );
btnUserCustom = findViewById( R.id.btnUserCustom );

Expand All @@ -112,11 +121,16 @@ private void initUI(){
btnUserCustom.setOnClickListener( this );

swNSFWOpen.setOnCheckedChangeListener( this );
swConfirmBeforeBoost.setOnCheckedChangeListener( this );
cbNotificationMention.setOnCheckedChangeListener( this );
cbNotificationBoost.setOnCheckedChangeListener( this );
cbNotificationFavourite.setOnCheckedChangeListener( this );
cbNotificationFollow.setOnCheckedChangeListener( this );

cbConfirmFollow.setOnCheckedChangeListener( this );
cbConfirmFollowLockedUser.setOnCheckedChangeListener( this );
cbConfirmUnfollow.setOnCheckedChangeListener( this );
cbConfirmBoost.setOnCheckedChangeListener( this );
cbConfirmToot.setOnCheckedChangeListener( this );
}

boolean loading = false;
Expand All @@ -134,44 +148,62 @@ private void loadUIFromData( SavedAccount a ){

loading = true;

swConfirmBeforeBoost.setChecked( a.confirm_boost );

swNSFWOpen.setChecked( a.dont_hide_nsfw );
cbNotificationMention.setChecked( a.notification_mention );
cbNotificationBoost.setChecked( a.notification_boost );
cbNotificationFavourite.setChecked( a.notification_favourite );
cbNotificationFollow.setChecked( a.notification_follow );


cbConfirmFollow.setChecked( a.confirm_follow );
cbConfirmFollowLockedUser.setChecked( a.confirm_follow_locked );
cbConfirmUnfollow.setChecked( a.confirm_unfollow );
cbConfirmBoost.setChecked( a.confirm_boost );
cbConfirmToot.setChecked( a.confirm_post );

loading = false;

boolean enabled = ! a.isPseudo();
btnAccessToken.setEnabled( enabled );
btnVisibility.setEnabled( enabled );
swConfirmBeforeBoost.setEnabled( enabled );

cbNotificationMention.setEnabled( enabled );
cbNotificationBoost.setEnabled( enabled );
cbNotificationFavourite.setEnabled( enabled );
cbNotificationFollow.setEnabled( enabled );

cbConfirmFollow.setEnabled( enabled );
cbConfirmFollowLockedUser.setEnabled( enabled );
cbConfirmUnfollow.setEnabled( enabled );
cbConfirmBoost.setEnabled( enabled );
cbConfirmToot.setEnabled( enabled );

updateVisibility();
showAcctColor();
}

private void showAcctColor(){
AcctColor ac = AcctColor.load( full_acct );
tvUserCustom.setText( ac!=null && !TextUtils.isEmpty( ac.nickname) ? ac.nickname : full_acct );
tvUserCustom.setText( ac != null && ! TextUtils.isEmpty( ac.nickname ) ? ac.nickname : full_acct );
tvUserCustom.setTextColor( ac != null && ac.color_fg != 0 ? ac.color_fg : Styler.getAttributeColor( this, R.attr.colorAcctSmall ) );
tvUserCustom.setBackgroundColor( ac != null && ac.color_bg != 0 ? ac.color_bg : 0 );
tvUserCustom.setBackgroundColor( ac != null && ac.color_bg != 0 ? ac.color_bg : 0 );
}

private void saveUIToData(){
if( loading ) return;
account.visibility = visibility;
account.confirm_boost = swConfirmBeforeBoost.isChecked();
account.dont_hide_nsfw = swNSFWOpen.isChecked();
account.notification_mention = cbNotificationMention.isChecked();
account.notification_boost = cbNotificationBoost.isChecked();
account.notification_favourite = cbNotificationFavourite.isChecked();
account.notification_follow = cbNotificationFollow.isChecked();

account.confirm_follow = cbConfirmFollow.isChecked();
account.confirm_follow_locked = cbConfirmFollowLockedUser.isChecked();
account.confirm_unfollow = cbConfirmUnfollow.isChecked();
account.confirm_boost = cbConfirmBoost.isChecked();
account.confirm_post = cbConfirmToot.isChecked();

account.saveSetting();

}
Expand All @@ -195,9 +227,9 @@ private void saveUIToData(){
open_browser( "https://" + account.host + "/" );
break;
case R.id.btnUserCustom:
ActNickname.open( this, full_acct, REQUEST_CODE_ACCT_CUSTOMIZE);
ActNickname.open( this, full_acct, REQUEST_CODE_ACCT_CUSTOMIZE );
break;

}
}

Expand Down Expand Up @@ -345,6 +377,6 @@ public void onCancel( DialogInterface dialog ){
progress.show();
AsyncTaskCompat.executeParallel( task );
}

}

6 changes: 6 additions & 0 deletions app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected void onCreate( @Nullable Bundle savedInstanceState ){
Switch swDisableFastScroller;
Switch swSimpleList;
Switch swExitAppWhenCloseProtectedColumn;
Switch swShowFollowButtonInButtonBar;

Spinner spBackButtonAction;
Spinner spUITheme;
Expand Down Expand Up @@ -69,6 +70,9 @@ private void initUI(){
swExitAppWhenCloseProtectedColumn = (Switch) findViewById( R.id.swExitAppWhenCloseProtectedColumn );
swExitAppWhenCloseProtectedColumn.setOnCheckedChangeListener( this );

swShowFollowButtonInButtonBar = (Switch) findViewById( R.id.swShowFollowButtonInButtonBar );
swShowFollowButtonInButtonBar.setOnCheckedChangeListener( this );

cbNotificationSound = (CheckBox) findViewById( R.id.cbNotificationSound );
cbNotificationVibration = (CheckBox) findViewById( R.id.cbNotificationVibration );
cbNotificationLED = (CheckBox) findViewById( R.id.cbNotificationLED );
Expand Down Expand Up @@ -130,6 +134,7 @@ private void loadUIFromData(){
swDisableFastScroller.setChecked( pref.getBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, true ) );
swSimpleList.setChecked( pref.getBoolean( Pref.KEY_SIMPLE_LIST, false ) );
swExitAppWhenCloseProtectedColumn.setChecked( pref.getBoolean( Pref.KEY_EXIT_APP_WHEN_CLOSE_PROTECTED_COLUMN, false ) );
swShowFollowButtonInButtonBar.setChecked( pref.getBoolean( Pref.KEY_SHOW_FOLLOW_BUTTON_IN_BUTTON_BAR, false ) );

cbNotificationSound.setChecked( pref.getBoolean( Pref.KEY_NOTIFICATION_SOUND, true ) );
cbNotificationVibration.setChecked( pref.getBoolean( Pref.KEY_NOTIFICATION_VIBRATION, true ) );
Expand All @@ -150,6 +155,7 @@ private void saveUIToData(){
.putBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, swDisableFastScroller.isChecked() )
.putBoolean( Pref.KEY_SIMPLE_LIST, swSimpleList.isChecked() )
.putBoolean( Pref.KEY_EXIT_APP_WHEN_CLOSE_PROTECTED_COLUMN, swExitAppWhenCloseProtectedColumn.isChecked() )
.putBoolean( Pref.KEY_SHOW_FOLLOW_BUTTON_IN_BUTTON_BAR, swShowFollowButtonInButtonBar.isChecked() )

.putBoolean( Pref.KEY_NOTIFICATION_SOUND, cbNotificationSound.isChecked() )
.putBoolean( Pref.KEY_NOTIFICATION_VIBRATION, cbNotificationVibration.isChecked() )
Expand Down
43 changes: 21 additions & 22 deletions app/src/main/java/jp/juggler/subwaytooter/ActColumnList.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import jp.juggler.subwaytooter.util.Utils;

public class ActColumnList extends AppCompatActivity {

static final String TMP_FILE_COLUMN_LIST = "tmp_column_list";

public static final String EXTRA_ORDER = "order";
public static final String EXTRA_SELECTION = "selection";

Expand All @@ -36,31 +39,25 @@ protected void onCreate( @Nullable Bundle savedInstanceState ){
initUI();

if( savedInstanceState != null ){
restoreData(
savedInstanceState.getString( EXTRA_ORDER )
, savedInstanceState.getInt( EXTRA_SELECTION )
);
restoreData( savedInstanceState.getInt( EXTRA_SELECTION ) );
}else{
Intent intent = getIntent();
restoreData(
intent.getStringExtra( EXTRA_ORDER )
, intent.getIntExtra( EXTRA_SELECTION, - 1 )
);
restoreData( intent.getIntExtra( EXTRA_SELECTION, - 1 ) );
}
}

@Override
protected void onSaveInstanceState( Bundle outState ){
super.onSaveInstanceState( outState );
//
outState.putInt( EXTRA_SELECTION, old_selection );

//
JSONArray array = new JSONArray();
List< MyItem > item_list = listAdapter.getItemList();
for( int i = 0, ie = item_list.size() ; i < ie ; ++ i ){
array.put( item_list.get( i ).json );
}
outState.putString( EXTRA_ORDER, array.toString() );
App1.saveColumnList( this,TMP_FILE_COLUMN_LIST,array );
}

@Override
Expand Down Expand Up @@ -133,25 +130,27 @@ public void onItemSwipeEnded( ListSwipeItem item, ListSwipeItem.SwipeDirection s
} );
}

void restoreData( String svColumnList, int ivSelection ){
void restoreData( int ivSelection ){

this.old_selection = ivSelection;

ArrayList< MyItem > tmp_list = new ArrayList<>();
try{
JSONArray array = new JSONArray( svColumnList );
for( int i = 0, ie = array.length() ; i < ie ; ++ i ){
try{
JSONObject src = array.optJSONObject( i );
MyItem item = new MyItem( src, i, this );
if( src != null ){
tmp_list.add( item );
if( old_selection == item.old_index ){
item.setOldSelection( true );
JSONArray array = App1.loadColumnList( this, TMP_FILE_COLUMN_LIST );
if( array != null ){
for( int i = 0, ie = array.length() ; i < ie ; ++ i ){
try{
JSONObject src = array.optJSONObject( i );
MyItem item = new MyItem( src, i, this );
if( src != null ){
tmp_list.add( item );
if( old_selection == item.old_index ){
item.setOldSelection( true );
}
}
}catch( Throwable ex2 ){
ex2.printStackTrace();
}
}catch( Throwable ex2 ){
ex2.printStackTrace();
}
}
}catch( Throwable ex ){
Expand Down
Loading

0 comments on commit 431d6f3

Please sign in to comment.