Add 'Details' button to about screen.
@@ -26,12 +26,17 @@ package com.b44t.ui;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.StateListAnimator;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.database.DataSetObserver;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.os.PowerManager;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.View;
|
||||
@@ -39,12 +44,15 @@ import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.AndroidUtilities;
|
||||
import com.b44t.messenger.ApplicationLoader;
|
||||
import com.b44t.messenger.BuildConfig;
|
||||
import com.b44t.messenger.LocaleController;
|
||||
import com.b44t.messenger.MrMailbox;
|
||||
import com.b44t.messenger.R;
|
||||
import com.b44t.ui.ActionBar.Theme;
|
||||
|
||||
@@ -65,6 +73,8 @@ public class IntroActivity extends Activity {
|
||||
private int[] titles;
|
||||
private int[] messages;
|
||||
|
||||
private boolean isAbout = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setTheme(R.style.Theme_MessengerProj);
|
||||
@@ -72,6 +82,11 @@ public class IntroActivity extends Activity {
|
||||
Theme.loadRecources(this);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if( extras != null && extras.getBoolean("com.b44t.ui.IntroActivity.isAbout") ) {
|
||||
isAbout = true;
|
||||
}
|
||||
|
||||
float heightOnLandscape = min(AndroidUtilities.displaySize.x,AndroidUtilities.displaySize.y)/AndroidUtilities.density;
|
||||
if( heightOnLandscape < 450 ) {
|
||||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
@@ -137,21 +152,48 @@ public class IntroActivity extends Activity {
|
||||
};
|
||||
}
|
||||
viewPager = (ViewPager) findViewById(R.id.intro_view_pager);
|
||||
TextView startMessagingButton = (TextView) findViewById(R.id.start_messaging_button);
|
||||
|
||||
String buttonTitle = ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging);
|
||||
Bundle extras = getIntent().getExtras();
|
||||
if( extras != null && extras.getString("buttonTitle")!=null ) {
|
||||
buttonTitle = extras.getString("buttonTitle");
|
||||
Button startMessagingButton = (Button) findViewById(R.id.start_messaging_button);
|
||||
Button detailsButton = (Button) findViewById(R.id.details_button);
|
||||
if( isAbout ) {
|
||||
startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.OK));
|
||||
detailsButton.setText(ApplicationLoader.applicationContext.getString(R.string.Info));
|
||||
detailsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
new AlertDialog.Builder(IntroActivity.this)
|
||||
.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName) + " v" + getVersion())
|
||||
.setMessage(MrMailbox.getInfo() + "\n\n" + getAndroidInfo())
|
||||
.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
startMessagingButton.setText(buttonTitle);
|
||||
else {
|
||||
startMessagingButton.setText(ApplicationLoader.applicationContext.getString(R.string.IntroStartMessaging));
|
||||
detailsButton.setVisibility(View.GONE);
|
||||
}
|
||||
startMessagingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(!isAbout) {
|
||||
if(startPressed) {
|
||||
return;
|
||||
}
|
||||
startPressed = true;
|
||||
Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
|
||||
intent2.putExtra("fromIntro", true);
|
||||
startActivity(intent2);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
StateListAnimator animator = new StateListAnimator();
|
||||
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
||||
animator.addState(new int[]{}, ObjectAnimator.ofFloat(startMessagingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
||||
startMessagingButton.setStateListAnimator(animator);
|
||||
}
|
||||
topImage1 = (ImageView) findViewById(R.id.icon_image1);
|
||||
topImage2 = (ImageView) findViewById(R.id.icon_image2);
|
||||
bottomPages = (ViewGroup) findViewById(R.id.bottom_pages);
|
||||
@@ -234,23 +276,57 @@ public class IntroActivity extends Activity {
|
||||
}
|
||||
});
|
||||
|
||||
startMessagingButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (startPressed) {
|
||||
return;
|
||||
}
|
||||
startPressed = true;
|
||||
Intent intent2 = new Intent(IntroActivity.this, LaunchActivity.class);
|
||||
intent2.putExtra("fromIntro", true);
|
||||
startActivity(intent2);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
justCreated = true;
|
||||
}
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
return pInfo.versionName;
|
||||
}
|
||||
catch(Exception e) {
|
||||
return "ErrVersion";
|
||||
}
|
||||
}
|
||||
|
||||
private String getAndroidInfo()
|
||||
{
|
||||
String abi = "ErrAbi";
|
||||
int versionCode = 0, ignoreBatteryOptimizations = -1;
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
versionCode = pInfo.versionCode;
|
||||
switch (versionCode % 10) {
|
||||
case 0:
|
||||
abi = "arm";
|
||||
break;
|
||||
case 1:
|
||||
abi = "arm-v7a";
|
||||
break;
|
||||
case 2:
|
||||
abi = "x86";
|
||||
break;
|
||||
case 3:
|
||||
abi = "universal";
|
||||
break;
|
||||
}
|
||||
if( Build.VERSION.SDK_INT >= 23 ) {
|
||||
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
||||
ignoreBatteryOptimizations = pm.isIgnoringBatteryOptimizations(ApplicationLoader.applicationContext.getPackageName())? 1 : 0;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
return "SDK_INT=" + Build.VERSION.SDK_INT
|
||||
+ "\nMANUFACTURER=" + Build.MANUFACTURER
|
||||
+ "\nMODEL=" + Build.MODEL
|
||||
+ "\nAPPLICATION_ID=" + BuildConfig.APPLICATION_ID
|
||||
+ "\nBUILD_TYPE=" + BuildConfig.BUILD_TYPE
|
||||
+ "\nABI=" + abi // ABI = Application Binary Interface
|
||||
+ "\nignoreBatteryOptimizations=" + ignoreBatteryOptimizations
|
||||
+ "\nversionCode=" + versionCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class SettingsActivity extends BaseFragment {
|
||||
// the list
|
||||
private int accountHeaderRow, usernameRow, accountSettingsRow, accountShadowRow;
|
||||
private int settingsHeaderRow, privacyRow, notificationRow, backgroundRow, advRow, settingsShadowRow;
|
||||
private int aboutHeaderRow, aboutRow, infoRow, aboutShadowRow;
|
||||
private int aboutHeaderRow, aboutRow, aboutShadowRow;
|
||||
private int rowCount;
|
||||
|
||||
private static final int ROWTYPE_SHADOW = 0;
|
||||
@@ -89,7 +89,6 @@ public class SettingsActivity extends BaseFragment {
|
||||
|
||||
aboutHeaderRow = rowCount++;
|
||||
aboutRow = rowCount++;
|
||||
infoRow = rowCount++;
|
||||
aboutShadowRow = rowCount++;
|
||||
|
||||
return true;
|
||||
@@ -148,75 +147,15 @@ public class SettingsActivity extends BaseFragment {
|
||||
}
|
||||
else if (i == aboutRow ) {
|
||||
Intent intent2 = new Intent(getParentActivity(), IntroActivity.class);
|
||||
intent2.putExtra("buttonTitle", ApplicationLoader.applicationContext.getString(R.string.OK));
|
||||
intent2.putExtra("com.b44t.ui.IntroActivity.isAbout", true);
|
||||
getParentActivity().startActivity(intent2);
|
||||
}
|
||||
else if( i== infoRow ) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(ApplicationLoader.applicationContext.getString(R.string.AppName) + " v" + getVersion());
|
||||
builder.setMessage(MrMailbox.getInfo() + "\n\n" + getAndroidInfo());
|
||||
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
;
|
||||
}
|
||||
});
|
||||
showDialog(builder.create());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return fragmentView;
|
||||
}
|
||||
|
||||
private String getVersion()
|
||||
{
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
return pInfo.versionName;
|
||||
}
|
||||
catch(Exception e) {
|
||||
return "ErrVersion";
|
||||
}
|
||||
}
|
||||
|
||||
private String getAndroidInfo()
|
||||
{
|
||||
String abi = "ErrAbi";
|
||||
int versionCode = 0, ignoreBatteryOptimizations = -1;
|
||||
try {
|
||||
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
||||
versionCode = pInfo.versionCode;
|
||||
switch (versionCode % 10) {
|
||||
case 0:
|
||||
abi = "arm";
|
||||
break;
|
||||
case 1:
|
||||
abi = "arm-v7a";
|
||||
break;
|
||||
case 2:
|
||||
abi = "x86";
|
||||
break;
|
||||
case 3:
|
||||
abi = "universal";
|
||||
break;
|
||||
}
|
||||
if( Build.VERSION.SDK_INT >= 23 ) {
|
||||
PowerManager pm = (PowerManager) ApplicationLoader.applicationContext.getSystemService(Context.POWER_SERVICE);
|
||||
ignoreBatteryOptimizations = pm.isIgnoringBatteryOptimizations(ApplicationLoader.applicationContext.getPackageName())? 1 : 0;
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
return "SDK_INT=" + Build.VERSION.SDK_INT
|
||||
+ "\nMANUFACTURER=" + Build.MANUFACTURER
|
||||
+ "\nMODEL=" + Build.MODEL
|
||||
+ "\nAPPLICATION_ID=" + BuildConfig.APPLICATION_ID
|
||||
+ "\nBUILD_TYPE=" + BuildConfig.BUILD_TYPE
|
||||
+ "\nABI=" + abi // ABI = Application Binary Interface
|
||||
+ "\nignoreBatteryOptimizations=" + ignoreBatteryOptimizations
|
||||
+ "\nversionCode=" + versionCode;
|
||||
}
|
||||
|
||||
private class ListAdapter extends BaseFragmentAdapter {
|
||||
private Context mContext;
|
||||
|
||||
@@ -233,7 +172,7 @@ public class SettingsActivity extends BaseFragment {
|
||||
public boolean isEnabled(int i) {
|
||||
return i == usernameRow || i == accountSettingsRow ||
|
||||
i == privacyRow || i == notificationRow || i == backgroundRow || i == advRow ||
|
||||
i == aboutRow || i == infoRow;
|
||||
i == aboutRow;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -283,9 +222,6 @@ public class SettingsActivity extends BaseFragment {
|
||||
else if (i == advRow) {
|
||||
textCell.setText(ApplicationLoader.applicationContext.getString(R.string.AdvancedSettings), false);
|
||||
}
|
||||
else if (i == aboutRow) {
|
||||
textCell.setText(ApplicationLoader.applicationContext.getString(R.string.AboutThisProgram), true);
|
||||
}
|
||||
}
|
||||
else if (type == ROWTYPE_HEADER) {
|
||||
if (view == null) {
|
||||
@@ -326,8 +262,8 @@ public class SettingsActivity extends BaseFragment {
|
||||
}
|
||||
textCell.setTextAndValue(LocaleController.getString("MyName", R.string.MyName), subtitle, true);
|
||||
}
|
||||
else if (i == infoRow) {
|
||||
textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.Info), "v" + getVersion(), false);
|
||||
else if (i == aboutRow) {
|
||||
textCell.setTextAndValue(ApplicationLoader.applicationContext.getString(R.string.AboutThisProgram), "v" + IntroActivity.getVersion(), false);
|
||||
}
|
||||
}
|
||||
return view;
|
||||
@@ -338,7 +274,7 @@ public class SettingsActivity extends BaseFragment {
|
||||
if (i == accountShadowRow || i == settingsShadowRow || i == aboutShadowRow ) {
|
||||
return ROWTYPE_SHADOW;
|
||||
}
|
||||
else if ( i == accountSettingsRow || i == usernameRow || i==infoRow ) {
|
||||
else if ( i == accountSettingsRow || i == usernameRow || i==aboutRow ) {
|
||||
return ROWTYPE_DETAIL_SETTINGS;
|
||||
}
|
||||
else if (i == settingsHeaderRow || i == aboutHeaderRow || i == accountHeaderRow) {
|
||||
|
||||
|
Before Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 186 B |
|
Before Width: | Height: | Size: 181 B |
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="#ff1c94cf">
|
||||
<item android:drawable="@drawable/regbtn2"/>
|
||||
</ripple>
|
||||
|
Before Width: | Height: | Size: 327 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 478 B |
|
Before Width: | Height: | Size: 483 B |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="true" android:drawable="@drawable/regbtn2_pressed" />
|
||||
<item android:state_checked="true" android:drawable="@drawable/regbtn2_pressed" />
|
||||
<item android:state_pressed="true" android:drawable="@drawable/regbtn2_pressed" />
|
||||
<item android:drawable="@drawable/regbtn2" />
|
||||
</selector>
|
||||
@@ -86,20 +86,40 @@
|
||||
android:layout_marginLeft="8dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView android:layout_width="wrap_content"
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/regbtn_states"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:textSize="16dp"
|
||||
android:textColor="#ffffff"
|
||||
android:id="@+id/bottom_pages"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="380dp"
|
||||
android:id="@+id/start_messaging_button"/>
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="380dp">
|
||||
|
||||
<Button android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:background="#bbbbbb"
|
||||
android:textColor="#ffffff"
|
||||
android:id="@+id/details_button"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/start_messaging_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:background="#2ca5e0"
|
||||
android:textColor="#ffffff"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</FrameLayout>
|
||||
|
||||