Skip to content

Commit

Permalink
0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
phantomVK committed Sep 28, 2019
1 parent f58807a commit c04494f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="SlideBack"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/java/com/phantomvk/slideback/demo/BaseActivity.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.phantomvk.slideback.demo;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.widget.RadioGroup;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.appcompat.widget.Toolbar;
Expand All @@ -28,6 +30,7 @@
* This class contains nothing about {@link SlideActivity}.
* Code moved here to make the subclass more easier to read.
*/
@SuppressLint("Registered")
public class BaseActivity extends SlideActivity {

private static int sIndex = 0;
Expand All @@ -39,6 +42,8 @@ public class BaseActivity extends SlideActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setWindow();
overridePendingTransition(R.anim.slide_in_right, 0);
setContentView(R.layout.activity_main);
}

/**
Expand All @@ -54,8 +59,12 @@ public void onContentChanged() {
Toolbar toolbar = findViewById(R.id.toolbar);
toolbar.setPadding(0, getStatusBarHeight(), 0, 0);
toolbar.setBackgroundColor(mColors[sIndex++ & (8 - 1)]);

setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setDisplayHomeAsUpEnabled(true);
}

AppCompatTextView textView = findViewById(R.id.text);
textView.setText(toString().split("\\.")[4]);
Expand Down
18 changes: 10 additions & 8 deletions app/src/main/java/com/phantomvk/slideback/demo/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
package com.phantomvk.slideback.demo;

import android.os.Bundle;
import android.view.MenuItem;

import com.phantomvk.slideback.SlideLayout;

public class MainActivity extends BaseActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
overridePendingTransition(R.anim.slide_in_right, 0);
setContentView(R.layout.activity_main);
}

@Override
public void onContentChanged() {
super.onContentChanged();
Expand All @@ -23,6 +16,15 @@ public void onContentChanged() {
}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
public void finishAfterTransition() {
SlideLayout l = slideManager.getSlideLayout();
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radioLeft"
style="@style/styleRadioButton"
style="@style/radioButtonStyle"
android:checked="true"
android:text="Left" />

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radioRight"
style="@style/styleRadioButton"
style="@style/radioButtonStyle"
android:text="Right" />

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radioTop"
style="@style/styleRadioButton"
style="@style/radioButtonStyle"
android:text="Top" />

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radioBottom"
style="@style/styleRadioButton"
style="@style/radioButtonStyle"
android:text="Bottom" />
</RadioGroup>
</androidx.appcompat.widget.LinearLayoutCompat>
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/values/strings.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<item name="toolbarStyle">@style/toolbarStyle</item>
</style>

<style name="styleRadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
<style name="radioButtonStyle" parent="Widget.AppCompat.CompoundButton.RadioButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@android:color/black</item>
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ buildscript {
// in the individual module build.gradle files
}
rootProject.ext {
versionCode = 15
versionName = "0.2.5"
versionCode = 16
versionName = "0.2.6"
}
}

Expand Down

0 comments on commit c04494f

Please sign in to comment.