82 lines
2.9 KiB
Java
82 lines
2.9 KiB
Java
package com.bottle.hp.album;
|
|
|
|
import android.R;
|
|
import android.content.res.Resources;
|
|
import android.os.Bundle;
|
|
import android.view.ViewGroup;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.TextView;
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class BaseActivity extends AppCompatActivity {
|
|
private boolean a;
|
|
private TextView b;
|
|
|
|
public boolean D0() {
|
|
return this.a;
|
|
}
|
|
|
|
public void b(int i, int i2) {
|
|
a(getString(i), i2);
|
|
}
|
|
|
|
@Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, androidx.core.app.ComponentActivity, android.app.Activity
|
|
protected void onCreate(Bundle bundle) {
|
|
super.onCreate(bundle);
|
|
try {
|
|
this.a = getResources().getBoolean(R$bool.isTablet);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
public void a(final String str, final int i) {
|
|
runOnUiThread(new Runnable() { // from class: com.bottle.hp.album.BaseActivity.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (BaseActivity.this.b != null) {
|
|
BaseActivity.this.a(str, i, BaseActivity.this.getResources());
|
|
BaseActivity.this.b.setVisibility(0);
|
|
return;
|
|
}
|
|
ViewGroup viewGroup = (ViewGroup) BaseActivity.this.findViewById(R.id.content);
|
|
Resources resources = BaseActivity.this.getResources();
|
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-1, -2);
|
|
BaseActivity baseActivity = BaseActivity.this;
|
|
baseActivity.b = new TextView(baseActivity);
|
|
BaseActivity.this.a(str, i, resources);
|
|
viewGroup.addView(BaseActivity.this.b, layoutParams);
|
|
}
|
|
});
|
|
this.b.postDelayed(new Runnable() { // from class: com.bottle.hp.album.BaseActivity.2
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
BaseActivity.this.b.setVisibility(4);
|
|
}
|
|
}, 2000L);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(String str, int i, Resources resources) {
|
|
this.b.setText(str);
|
|
if (D0()) {
|
|
this.b.setTextSize(20.0f);
|
|
} else {
|
|
this.b.setTextSize(12.0f);
|
|
}
|
|
this.b.setGravity(17);
|
|
this.b.setTextColor(-1);
|
|
if (i == 0) {
|
|
this.b.setBackgroundColor(resources.getColor(R$color.snackbar_level_waiting));
|
|
} else if (i == 1) {
|
|
this.b.setBackgroundColor(resources.getColor(R$color.snackbar_level_success));
|
|
} else {
|
|
if (i != 2) {
|
|
return;
|
|
}
|
|
this.b.setBackgroundColor(resources.getColor(R$color.snackbar_level_error));
|
|
}
|
|
}
|
|
}
|