Skip to content

Commit

Permalink
add on click listner for check for update button
Browse files Browse the repository at this point in the history
  • Loading branch information
androidlover5842 committed Dec 21, 2016
1 parent e65d22b commit 88525dd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Updater.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<RomUpdater>
<update>
<RomLatestVersion>20161220</RomLatestVersion>
<RomLatestVersion>20161230</RomLatestVersion>
<URL>https://github.com/Arubadel/Arubadel/releases/download/untagged-71b60b7351492a2477d1/app-release.apk</URL>
<Changelog>
- Test Updater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
package io.github.otaupdater.otaupdater;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import io.github.otaupdater.otaupdater.fragment.GithubReleasesFragment;

public class MainActivity extends AppCompatActivity {

private GithubReleasesFragment mFragmentOldRelease;
private Button mCheckUpdate;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.mFragmentOldRelease = new GithubReleasesFragment().setTargetURL(Config.URL_OLD_RELEASES);
updateFragment(mFragmentOldRelease);
mCheckUpdate=(Button)findViewById(R.id.activity_main_check_for_update);
mCheckUpdate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getBaseContext(), DialogActivity.class);
startActivity(i);
}
});
}
protected void updateFragment(Fragment fragment)
{
Expand Down
24 changes: 5 additions & 19 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="io.github.otaupdater.otaupdater.MainActivity"
android:gravity="bottom">

<TextView
android:text="Latest Release"
android:text="@string/latest_release"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/title_margin_bottom"
android:id="@+id/textView1"
android:textAppearance="@style/TextAppearance.AppCompat.Display1"
android:textSize="18sp" />
Expand All @@ -24,17 +19,13 @@
android:layout_width="match_parent"
android:id="@+id/current_release"
android:layout_height="wrap_content"
android:paddingTop="@dimen/main_frame_top"
android:paddingBottom="@dimen/main_frame_bottom"
android:paddingRight="@dimen/main_frame_right"
android:paddingLeft="@dimen/main_frame_left"
android:background="@drawable/square"
android:layout_below="@+id/textView1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />

<TextView
android:text="Previous Releases"
android:text="@string/previous_releases"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView2"
Expand All @@ -49,30 +40,25 @@
android:layout_width="match_parent"
android:id="@+id/content_frame"
android:layout_height="120pt"
android:paddingTop="@dimen/main_frame_top"
android:paddingBottom="@dimen/main_frame_bottom"
android:paddingRight="@dimen/main_frame_right"
android:paddingLeft="@dimen/main_frame_left"
android:background="@drawable/square"
android:layout_marginTop="21dp"
android:layout_below="@+id/textView2" />

<Button
android:text="Check For Update now"
android:text="@string/check_for_update_now"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/button"
android:id="@+id/activity_main_check_for_update"
android:layout_below="@+id/content_frame"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="23dp"
style="@style/Widget.AppCompat.Button.Borderless"
android:elevation="0dp"
android:fontFamily="casual"
android:textStyle="normal|bold" />

<TextView
android:text="Last Check"
android:text="@string/last_check"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/last_check"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="no_network_available">No network available</string>
<string name="something_went_wrong">Oops! Something went wrong</string>
<string name="connecting_to_github">Connecting to Github…</string>
<string name="check_for_update_now">Check For Update now</string>
<string name="last_check">Last Check</string>
<string name="previous_releases">Previous Releases</string>
<string name="latest_release">Latest Release</string>
</resources>

0 comments on commit 88525dd

Please sign in to comment.